jwk811 Posted April 5, 2010 Share Posted April 5, 2010 there is a working file input in the form. when i process it EVEN if nothing was uploaded it still will say that the FILES input isset and != ''. how can i see if its actually being used? Quote Link to comment https://forums.phpfreaks.com/topic/197639-see-is-a-files-input-was-used/ Share on other sites More sharing options...
JustLikeIcarus Posted April 5, 2010 Share Posted April 5, 2010 Try putting this in your code. Replace "thefile" with the name of your file input element. if(array_key_exists('thefile', $_FILES)) { // Handle the uploaded file here } Quote Link to comment https://forums.phpfreaks.com/topic/197639-see-is-a-files-input-was-used/#findComment-1037254 Share on other sites More sharing options...
PFMaBiSmAd Posted April 5, 2010 Share Posted April 5, 2010 If a file is not selected, you will get an upload error value of 4. I recommend examining and using some for the error checking logic in this post - http://www.phpfreaks.com/forums/index.php/topic,292945.msg1386624.html#msg1386624 Quote Link to comment https://forums.phpfreaks.com/topic/197639-see-is-a-files-input-was-used/#findComment-1037258 Share on other sites More sharing options...
the182guy Posted April 5, 2010 Share Posted April 5, 2010 if(isset($_FILES['myfile']) && $_FILES['myfile']['error'] != UPLOAD_ERR_NO_FILE) { // no file was uploaded, there could be a different error though } Quote Link to comment https://forums.phpfreaks.com/topic/197639-see-is-a-files-input-was-used/#findComment-1037259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.