jameswwright Posted May 17, 2006 Share Posted May 17, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/9879-uploaded-image-reading-problem/ Share on other sites More sharing options...
jameswwright Posted May 19, 2006 Author Share Posted May 19, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/9879-uploaded-image-reading-problem/#findComment-37310 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.