Jump to content

ASP - Image Upload


Recommended Posts

Hi all

 

I have a ASP problem i'm wondering if anyone can help with.

 

I have a form which has the following field on it

 

<input type="file" NAME="image2">

 

I then have the following code to upload the image

 

	dim filename2
filename2 = UploadRequest("image2").Item("filename2")
filename2 = Right(filename2,Len(filename2)-InstrRev(filename2,"\"))
if not filename2="" then	
	if instr(ucase(filename2),".GIF")>0 or instr(ucase(filename2),".JPG")>0 or instr(ucase(filename2),".PNG")>0 then
		UploadPath=server.mappath("../prod_images/")&"\"
		if not filename2="" then
			if instr(ucase(filename2),".GIF") then
				filename2=imageID &"-2.gif"
			elseif instr(ucase(filename2),".JPG") then
				filename2=imageID &"-2.jpg"
			elseif instr(ucase(filename2),".PNG") then
				filename2=imageID &"-2.png"
			end if
			UploadPathFN=UploadPath&filename2
			ImgKBSize=savefile("image2",UploadPathFN)/1024
			if ImgKBSize>250 then
				deleteFile(UploadPathFN)
				msg=msg &"
You can only upload images under 250kb."
			end if
		end if	
	else
		msg=msg &"
You can only upload *.gif, *.jpg and *.png files."
	end if
end if

 

but for some reason this has stopped working and I cannot figure out why.

 

Can anyone figure out why this is happening?

 

Thanks everyone in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.