Jump to content


Photo

uploaded image reading problem


  • Please log in to reply
1 reply to this topic

#1 jameswwright

jameswwright
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 17 May 2006 - 08:59 PM

Hi,

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.
<?php
$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.

#2 jameswwright

jameswwright
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 19 May 2006 - 10:23 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users