Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to check the size of a file submitted from a form.

Status
Not open for further replies.

martindavey

Programmer
Jan 2, 2000
122
GB
I have an input type=file in my form.
When the user selects a file, I want to check that it meets my criteria:

eg.
must be 150x150 pixels in size,
must be less than 150kb in size
must be gif/jpg/bmp/pcx/tif/png
must not exist already.

Ideally I would like to check these details on the client using javascript before submitting the form, but if that's not possible I would like to know how to check these details using asp.
 
If you are using dreamweaver Ultradev, go to and find the extension "pure ASP upload" which is an upload script not needing a 3rd party component.

Using the script you can determine the size of an image, the type of image (gif? jpg?) and the colour depth.

If you aren't using UD, drop me a note and I will email you the code, but you will have to make it work yourself ( not too hard for 1/2 decent coder).

As for file size, use (Request.ServerVariables("HTTP_Content_Length") and you should be right.
Steve Davis
hey.you@hahaha.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top