Jump to content
Larry Ullman's Book Forums

Chapter 19 Adding Images To The Uploads Folder

Recommended Posts

For some reason the images I am uploading to my uploads folder are just showing as blank, the files are there but it is not showing them as images. It is written that the type of file it is is just File. and it shows the path to the image D:\xampp\htdocs\uploads.

My add_print.php is just fine as far as I can tell. I tested it with the script written by Larry in the working files for this book, it doesn't work either. I checked my permissions for my uploads folder and they look fine too. 


I am thinking the problem is maybe because no Mime type is specified for the images being uploaded. If that isn't where the error is, it is maybe in the code below, where my uploads folder is. it is specified as ../../../uploads. any help would be appreciated.


if (is_uploaded_file($_FILES['image']['tmp_name'])){
$temp = '../../../uploads/' . md5($_FILES['image']['name']);
if (move_uploaded_file($_FILES['image']['tmp_name'], $temp)){
echo '<p>The file has been uploaded!</p>';
$i = $_FILES['image']['name'];
or could the problem be below:?
if (mysqli_stmt_affected_rows($stmt) == 1){
echo '<p>The print has been added.</p>';
$id = mysqli_stmt_insert_id($stmt);
rename ($temp, "../../../uploads/$id");
$_POST = array();


Link to comment
Share on other sites

  • 5 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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