I have a problem with uploading file, I am Using this code...... and getting this error,
my folder name is garment_images
<?php
$pid = mysql_insert_id();
$folder = $_post['catagory'];
//insert images into folder
$product_name = "$pid.jpg";
move_uploaded_file($_FILES['productImage']['tmp_name'], "$folder._images" / $product_name);
echo "<h1>Your product successfully added <br /> Plese wait....</h1>";
header("refresh:3; url='inventory.php'");
exit();
?>
<form method='post' action='index.php'>
<input type="file" name="productImage" />
<input type="text" name="catagory" />
</form>
You wrote 'refreash', correct is 'refresh'.
Several mistakes corrected, here is your code:
<?php
$pid = mysql_insert_id();
$folder = $_POST['category']; // assuming you had category other wise, no correction
//insert images into folder
$product_name = "$pid.jpg";
move_uploaded_file($_FILES['productImage']['tmp_name'], "$table._images/ $product_name"); // string concat mistake
echo "<h1>Your product successfully added <br /> Please wait....</h1>";
echo "<meta http-equiv='refresh' content='3; inventory.php' />";// use meta tag to redirect instead of header which will give you headers already sent error
// exit(); // if not commented out, the below form will never be shown!
?>
<form method='post' action='index.php'>
<input type="file" name="productImage" />
</form>
I strongly suggest you use an IDE while coding if you are getting started with PHP, and need help with it.