File size

G

Guest

All,

I have a ASP.NET page using C# to upload a file to a server via the
filefield control. I would like to restrict the size of the file a user can
upload to say 1mb but would like to check the size of the file on the client
computers and not when the file has been uploaded. I am guessing I need to
use some client script can someone help me out?

Thanks
Msuk
 
C

Champika Nirosh

Use ...
System.Web.UI.HtmlControls.HtmlInputFile

there

myFile.PostedFile.ContentLength; is the size of the file in byte..

Nirosh.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

AFAIK there is no way to control that in the client, you have to do it in
the server side using PostedFile.ContentLength

Cheers,
 
G

Guest

hi,

I would like to make the check at the client end thus saving the uploading
of the file it is it too big. Is there any client side script I could use to
check the size of the file before uploading it?

Thanks
Msuk
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

NOP, You could search in a javascript NG for that answer but there is none
AFAIK.

If you do find one solution, please post it back here.

cheers,
 

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

Top