Note that there are some explanatory texts on larger screens.

plurals
  1. POMulti part form data using PHP. (Image Upload)
    primarykey
    data
    text
    <p>So I'm having a problem with my php file and being able to upload images to a folder. I'm rather new to php so I'm a bit rusty with the jargon. This code allows an admin user to add new products to a store by adding text fields and uploading images. The text is fine, the problem lies with the images not uploading to the specified folder. The database table recognises an update has taken place, but with the php code listed below, this is how it updates...</p> <p><a href="http://i.imgur.com/CnloamI.png" rel="nofollow">http://i.imgur.com/CnloamI.png</a></p> <p>Any Help would be greatly appreciated :)</p> <pre><code>&lt;?php include('../connect.php'); $inserted = insert($_FILES['addimage1'], 'image1'); $inserted = insert($_FILES['addimage2'], 'image2'); $inserted = insert($_FILES['addimage3'], 'image3'); function insert($file, $image_col_name) { $addid= $_POST['addrow']; $addproduct= mysql_real_escape_string(htmlentities($_POST['addproduct'])); $addprice= mysql_real_escape_string(htmlentities($_POST['addprice'])); $addprevprice= mysql_real_escape_string(htmlentities($_POST['addprevprice'])); $adddetails= mysql_real_escape_string(htmlentities($_POST['adddetails'])); $addimage = mysql_real_escape_string($file['name']); $addimagetemp = mysql_real_escape_string($file['tmp_name']); $addimagetype = mysql_real_escape_string($file['type']); $addimagesize = mysql_real_escape_string($file['size']); if (!empty($addimage)) { if ($addimagetype == 'image/gif' || $addimagetype == 'image/jpg' || $addimagetype == 'image/jpeg' &amp;&amp; $addimagesize &gt; 0 &amp;&amp; $addimagesize &lt; 2000000) { move_uploaded_file($addimagetemp,"../img/camera/$addimage"); $query = "INSERT INTO admincamera (product, price, prevprice, details, $image_col_name)"."VALUES('$addproduct', '$addprice', '$addprevprice', '$adddetails', '$addimage')"; } else { echo "&lt;p&gt;file needs to be a jpg/gif or file size too big.&lt;/p&gt;"; die(); } } else { $query = "INSERT INTO admincamera (product, price, prevprice, details)"."VALUES('$addproduct', '$addprice', '$addprevprice', '$adddetails')"; } mysql_query($query) or die(mysql_error()); return true; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload