Jump to content


This topic is now archived and is closed to further replies.


uploaded image reading problem

Recommended Posts


I am having some trouble with the images that I upload through the browser using a php script. They go into the directory fine, and are sitting there, but when I try to display the image in an html page it doesnt show up. Oh i should add that I have other images in the same directory that were uploaded through ftp, and they show up fine, in html. I also noticed that if I download the image off of the server, its icon is a dreamweaver icon, and the rest of my images have the photoshop icon, so I'm wondering if maybe something gets screwed up in how the file is read when it gets sent through the form. Here is the code i used to upload the image.
$upload_tmp_dir = "/tmp";
$uploadedfile = "images/products/{$_FILES['uploadedfile'] ['name']}";
$size = getimagesize($_FILES['uploadedfile']['tmp_name']);
if($_FILES['uploadedfile']['type'] == "image/png" || $_FILES['uploadedfile']['type'] == "image/jpg" || $_FILES['uploadedfile']['type'] == "image/jpeg" || $_FILES['uploadedfile']['type'] == "image/pjpeg" || $_FILES['uploadedfile']['type'] == "image/gif") {
if(move_uploaded_file ($_FILES['uploadedfile']['tmp_name'], $uploadedfile)) {
echo "File successfully uploaded";
} else {
echo "Failure to upload";
} else {
echo "invalid filetype";
Does anything look wrong with this?

Thanks folks.

Share this post

Link to post
Share on other sites
I've narrowed it down a bit now, the CHMOD of the files is for some reason defaulting so that only owner can read. I have the directory its in set as 0777 through the control panel, but I am not having any luck setting the files to 0755 or even 0777 inside the directory. I have not used the CHMOD function much before, and I cant seem to get the examples from php.net working. Can anybody help?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.