Image not moved to folder

Hi all,

I’ve got a front-end page that i can use to ‘add products’ …I’m having trouble getting the image to be moved into the ‘uploads’ folder…

Here is my script below;

function add_product() {

    if(isset($_POST['publish'])) {
    $product_title          = escape_string($_POST['product_title']);
    $product_category_id    = escape_string($_POST['product_category_id']);
    $product_price          = escape_string($_POST['product_price']);
    $product_description    = escape_string($_POST['product_description']);
    $short_product_description = escape_string($_POST['short_product_description']);
    $product_quantity       = escape_string($_POST['product_quantity']);
    $product_image          = $_FILES['file']['name'];
    $image_temp_location    = $_FILES['file']['tmp_name'];
    move_uploaded_file($image_temp_location  , UPLOAD_DIRECTORY . DS . $product_image);

    $query = query("INSERT INTO products(product_title, product_category_id, product_price, product_description, short_product_description, product_quantity, product_image) VALUES('{$product_title}', '{$product_category_id}', '{$product_price}', '{$product_description}', '{$short_product_description}', '{$product_quantity}', '{$product_image}')");
    $last_id = last_id();
    set_message("New Product with id {$last_id} was Added");

I’ve checked folder missions and they are read and write too…

Any pointers would be great, thank you…

Sorted now. I was referencing the folder to a different location to where it actually was, my bad!

Sponsor our Newsletter | Privacy Policy | Terms of Service