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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp upload - validating image size and type before upload

Status
Not open for further replies.

spastica

Programmer
Sep 27, 2002
72
GB
I am creating an upload tool using aspsimpleupload.

I want to make sure the file the user uploads is a jpg, and under 1mb before the actual upload is allowed, so there are no malicious uploads. is there any way to do this? does aspsimpleupload store the file temporarily before uploading? i can't find any documentation on the web.



 
I'm not sure about aspSimpleUpload but if you use the aspUpload component you can set "setMaxSize" to ensure that the upload doesn't exceed 1M

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
As for verifying that the file is actually a jpg, you could first check its file extension. For better verification you could perhaps you could find an ActiveX/COM object that can manipulate JPGs. Then you create the object in server-side code ASP and use use the object to manipulate the uploaded file. If the file is not a real JPG then it the object should be able to report it or at least throw a trappbable error.
 
thank you - but we don't have any other components, there is another way i am thinking of. post coming up...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top