Jump to content

uploaded image reading problem


jameswwright

Recommended Posts

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.
[code]
<?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";
}
?>
[/code]
Does anything look wrong with this?

Thanks folks.
Link to comment
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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

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.