Users must submit a fully qualified path when you use the "input type=file" element in a Web application in Windows XP Service Pack 2 (892442)
The information in this article applies to:
- Microsoft Windows XP Service Pack 2, when used with:
- Microsoft Windows XP Home Edition
- Microsoft Windows XP Professional
SYMPTOMSIn Microsoft Windows XP Service Pack 2 (SP2), you may use an input type=file element in an application. If you let the user type a path in the text box part of the element and they do not provide a fully qualified path that includes the drive and root folder, one of the following conditions occurs: - If the user submits the form by using an input type=submit element, nothing occurs.
- If the user tries to submit the form that contains the control by clicking a link, and that link invokes JavaScript code that calls the Submit method, the user receives an "Access is Denied" scripting error message. For example, postbacks for server-side Microsoft ASP.NET controls may use the Submit method.
WORKAROUNDTo work around this behavior, follow these steps: - If you can access the code that calls the Submit method, handle the script error, and then prompt the user to enter a fully qualified path.
- Prevent the user from editing the contents of the text box. This effectively forces the user to click Browse to choose the file path.
For example, use the following code example to prevent the user from editing the text box contents in Microsoft Internet Explorer.
<html>
<head>
<script language="javascript">
<!--
function test()
{
if( event.keyCode == 8 )
{
return false;
}
return true;
}
-->
</script>
</head>
<body>
<form name="Form1" action="SimpleResults.aspx" method="post" ID="Form1">
<input id="txtFileUpload" onkeydown="return test();" onbeforeeditfocus="return false;" type="file" name="txtFileUpload" />
<p />
<input type="submit" value="Submit" ID="Submit1" NAME="Submit1" />
</form>
</body>
</html> - Create your own ActiveX control to provide this functionality.
STATUS
This behavior is by design.REFERENCESFor more information, visit the following Microsoft Developer Network (MSDN) Web site:
Modification Type: | Major | Last Reviewed: | 5/4/2005 |
---|
Keywords: | kbprb KB892442 kbAudDeveloper |
---|
|