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? Link to comment https://forums.phpfreaks.com/topic/93865-uploading-file-help/ Share on other sites More sharing options...
zq29 Posted March 1, 2008 Share Posted March 1, 2008 Try: if($_FILES['filename']['error'] != 4) { //code } Link to comment https://forums.phpfreaks.com/topic/93865-uploading-file-help/#findComment-480988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.