Upload File Size

G

Guest

I am using <INPUT id="File1" type="file" name="File1" runat="server"> to
upload file to the server.

My Questions:
1. Is it possible to check the file size before the file is uploaded other
than using
Scripting.FileSystemObject ?

2. If answer to 1 is no, is it possible to check in the server side the
Request.ContentLength and prevent the exception/ blank page if the file size
exceeds the value in <httpRuntime maxRequestLength="4000" />. Ie Stop the
http request and show the previous page. I do not want to refresh the page as
there may be some data in the submitted page which should not be cleared.

3. If answer to 2 is no. I can set a very large value in <httpRuntime
maxRequestLength="400000000" />. If the contentlength is large is there a way
in the server side to stop the upload and show the user submitted page with
an error message.
 
S

Siva M

1. File size cannot be checked on the client-side as there is no way to
access the local file system from a web page

2 & 3: Information about the file uploaded in only available after the
complete file content has been uploaded and hence upload cannot be stopped
in the middle.


I am using <INPUT id="File1" type="file" name="File1" runat="server"> to
upload file to the server.

My Questions:
1. Is it possible to check the file size before the file is uploaded other
than using
Scripting.FileSystemObject ?

2. If answer to 1 is no, is it possible to check in the server side the
Request.ContentLength and prevent the exception/ blank page if the file size
exceeds the value in <httpRuntime maxRequestLength="4000" />. Ie Stop the
http request and show the previous page. I do not want to refresh the page
as
there may be some data in the submitted page which should not be cleared.

3. If answer to 2 is no. I can set a very large value in <httpRuntime
maxRequestLength="400000000" />. If the contentlength is large is there a
way
in the server side to stop the upload and show the user submitted page with
an error message.
 
S

Steve C. Orr [MVP, MCSD]

Due to security restrictions the only way to provide a rich upload
experience like you describe is for the user to install a rich client of
some kind that can access the file system, such as an ActiveX control or a
windows forms app or control of some kind that has the necessary
permissions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top