Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: File Uploading problem
05-23-2009, 09:09 PM #1
- Join Date
- May 2009
- North west England
- Thanked 0 Times in 0 Posts
File Uploading problem
I have a site under development that allows a punter to upload a single file to the web server. I use ASP.NET. The html fragment that allows the punter to select the file to upload is the well known
<input type=file id=file1 name=file1 runat="server" />
which enables the punter to select a file and populate a textbox with a path such as \Test documents\TestdoxA
The problem is that if this file is bigger than about 4 Mb, the upload process goes wrong and the result can look a mess to the punter.
At the point where \Test documents\TestdoxA appears in the textbox, (and before the punter presses the upload button) I would like to intervene and find the length of the file in bytes. Then, if it is too long, bring up a window to warn the guy off.
05-24-2009, 01:42 AM #2
- Join Date
- Apr 2009
- Thanked 426 Times in 424 Posts
There is no sure fire cross browser way to do that. What you should do is inform the user that there is a file size limit and change your server side code, so that it does not present the user with "a mess", if she decides to upload files exceeding the limit, but with a user friendly message informing her about her mistake.
Users who have thanked venegal for this post: