Hi Haim,
The form is not submitted because by default IE will not allow it if the
file upload control contains invalid path (it doesn't mean that the file
doesn't exist, just mean invalid path format, for exmaple, a space is
inserted at the front of the file name).
You can check this using a RegularExpressionValidator:
<form id="form1" runat="server">
<div>
<asp:FileUpload ID="file1" runat="server" />
<asp:Button ID="button1" Text="Upload" runat="server" />
<asp:RegularExpressionValidator ID="val1" runat="server"
ControlToValidate="file1" EnableClientScript="true" ErrorMessage="Please
make sure valid file"
ValidationExpression="^[^\s].*"></asp:RegularExpressionValidator>
</div>
</form>
You can test this by:
1) Select a file by using the "Browse..." button of the file upload control
2) Insert a space at the front of the file name of the file upload control;
press TAB twice to cause it lose focus; you will notice the validator
failed and its error message is shown.
Please test it and tell me the result. If your code doesn't work, please
create a reproducible project and post it here or send it to me. Thank you.
Sincerely,
Walter Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.