Jump to content

if statement not working


garry

Recommended Posts

So i'm using some user supplied info from a form and the form contains a place where the user can specify an image file to be uploaded. This works fine when the image file is actually chosen, but if they do not select the image file, i don't want the script to use any of the image variables or anything, which is why I have the following code:

 

	if (isset($HTTP_POST_FILES['image']) && !empty($HTTP_POST_FILES['image'])) { // Check if image has been uploaded

 

And also, I'm just using

<input name="image" type="file" />

inside the actual form.

 

But for some reason, when no file is uploaded, it still tries to do the things inside my if statement :(

 

Can anyone help?

Link to comment
https://forums.phpfreaks.com/topic/108207-if-statement-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.