XAMPP upload folder


#1

Hello all. I can´t move forward on my project.
I have trouble with uploading files (images) to the folder I have create in root directory. The file always stucks in the ‘htdocs/system_restaurant’ which is where I don´t want to it. Here is the script:

$uploads_dir = ‘C:\xampp\htdocs\system_restaurant\uploads’;

//Validating data script

$uploaded_file = basename($uploads_dir).$_FILES[‘file’][‘name’];

if (is_uploaded_file($_FILES[‘file’][‘tmp_name’])) {
if (!move_uploaded_file($_FILES[‘file’][‘tmp_name’],
$uploaded_file)) {
throw new Exception(’ The file is not possible to move into uploads directory.’);
exit;
}
}else {
throw new Exception(‘Should be an uploading file attack’.$_FILES[‘file’][‘name’]);
exit;
}

} catch (Exception $e) {
$unsuccess_upload = new OutputFns();
echo $e;
$unsuccess_upload->displayMemberPage();
}

echo “The file have been uploaded successfully”;

I appreciate all of advises


#2

You are not telling the code where to move the uploaded file. Here is an example line.

move_uploaded_file($file_tmp,“images/”.$file_name);


#3

Really, really THANK YOU . My script is working correctly now.