Jump to content

function move_uploaded_file(); is not moving the file to the assiged folder


co.ador

Recommended Posts

Guys thanks..

 

PMF thank you for the steps they help me I did all of them I declared and filter all the variables before validation and then process the image move_uploaded_ifle and the data field insert and worked much better.

 

After the script check there is not error or Variable $errors is === 0 then I executed the move_uploaded script function. I realized too that the path was not being specified correctly I needed to specified from the root level. I just need to replace basename($_FILES['file']['name']) for $newname = $id.".jpg"; so that the name of the picture is equal to the id of the product.

 

<?php 
if (0 === count($errors)){
  // $newname = $id . ".jpg";
$uploaddir = '/home3/nyh/public_html/youryardsales/inventory_images/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
} else {
    echo "Possible file upload attack!\n";
}
//rest of the code.

?>

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.