Note that there are some explanatory texts on larger screens.

plurals
  1. POEdit File Image Upload using PHP
    primarykey
    data
    text
    <p>I've been having issues with file upload. After help on this site I managed to upload the files successfully to the db and can pull them back to show the images.Part of my assessment is the fact I need the ability to edit my photo choices (by say choosing a different image and maybe keeping one or two the same) and then the user can submit any changes they may wish to make.So on a separate file called 'edit.php' I have pre-populated all the other data that was entered in the db (this works fine) My code looks like:</p> <pre><code>&lt;label for ="file"&gt;Filename:&lt;/label&gt; &lt;?php echo "&lt;img src='upload/".$_FILES['filename']."' /&gt;"; ?&gt; &lt;input type="file" name="file[]" id="file" &gt; &lt;?php echo "&lt;img src='upload/".$_FILES['filename']."' /&gt;"; ?&gt; &lt;input type="file" name="file[]" id="file" &gt; &lt;?php echo "&lt;img src='upload/".$_FILES['filename']."' /&gt;"; ?&gt; &lt;input type="file" name="file[]" id="file" &gt; </code></pre> <p>PHP:</p> <pre><code> $name = strtolower($name); $allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $name); $extension = end($temp); if(in_array($extension, $allowedExts)) { if($_FILES['file']['size'][$f] &lt; 2000000) { $uniqid = uniqid(); move_uploaded_file($_FILES["file"]["tmp_name"][$f], "upload/" . $uniqid . "." . $extension); mysql_query("INSERT INTO vehiclesimages (vehicleid, filename) VALUES (".$last_id.", '".$uniqid .".".$extension."')"); } else { echo "File size to big!"; } } else { echo "Image not supported, please try again!"; } </code></pre> <p>Any ideas/help or useful sites would be greatly appreciated.As I have been unable to research any info on the subject.</p>
    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.
    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