PDA

Click to See Complete Forum and Search --> : uploading images...


rammy
Jan 2nd, 2001, 01:42 AM
Hi,

I need to upload images(jpegs and gifs) to the server. This I've managed. But what I haven't been able to do is check whether the file being uploaded is a valid one or not. For example, if I open notepad and then save the file with a .jpg extension, and then try to upload it, it gets uploaded. which should not happpen. Any ideas on how I can prevent this???

Thanx.

itay222
Jan 2nd, 2001, 02:18 AM
maybe it depends on what COM you are using to
upload the files.
in SA-FileUP (tm?),
you can query on the MIME type like this:

var upl = Server.CreateObject("SoftArtisans.FileUp")
if (upl.Form("FILENAME").ContentType=="application/msword")
or "text/html" or "image/jpes"...

itay.

rammy
Jan 2nd, 2001, 02:55 AM
??? could u elaborate on that....

itay222
Jan 2nd, 2001, 02:59 AM
could you elaborate your question?

what i was explaining,
is how to detect file type (MIME) of uploaded file
(using html FORM and INPUT TYPE=FILE)
via SA-filpup componenent, in jscript ASP.

itay.

rammy
Jan 2nd, 2001, 03:04 AM
Ive used the code from http://www.planetsourcecode.com to carry out the upload process. I need to be able to validate the file being uploaded (whether its a valid image file or not).

rammy
Jan 3rd, 2001, 12:44 AM
any ideas??

rammy
Jan 5th, 2001, 01:24 AM
yet another post to bring this thread to the top........

[Edited by rammy on 01-08-2001 at 01:59 AM]

rammy
Jan 8th, 2001, 01:02 AM
im starting to talk to myself here.... :(

Shafee
Jan 12th, 2001, 05:20 PM
Hi there rammy,

The planetsourcecode.com code is extremely complex don't you think? Since you have successfully completed the upload process with that code, can you please explain what is actually done in the code?

Thanks in advance

MrMicrosoft
Jan 12th, 2001, 06:14 PM
You can write a VB program that will download the image. If an error occurs when displaying the image, you know that the file is not an image.