usadarts Posted March 1, 2008 Share Posted March 1, 2008 Hello All, A form can be filled out and NOT have a file uploaded. If no file is selected, I do NOT want to run the following: $uploaddir = '../../flyers/'; $uploadfile = $uploaddir . basename($_FILES['filename']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } print "</pre>"; I added the below around the code, but does not work. if (basename($_FILES['filename']['name']) != ' '){ ...... } Any suggestions? Quote Link to comment Share on other sites More sharing options...
zq29 Posted March 1, 2008 Share Posted March 1, 2008 Try: if($_FILES['filename']['error'] != 4) { //code } Quote Link to comment 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.