Jump to content

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


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.

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.