Jump to content

Uploading File Help


usadarts

Recommended Posts

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

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.