waverider303 Posted March 29, 2009 Share Posted March 29, 2009 When i use the move_uploaded_file to upload images I think it is uploading using ASCII mode to transfer. Because when I goto view the image that I uploaded I get an error. Im using shared hosting from Doteasy.com do I need to change information in the php.ini file to make it upload in binary? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 29, 2009 Share Posted March 29, 2009 There is no such setting. What is your processing code and the code that outputs the image? Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 29, 2009 Author Share Posted March 29, 2009 $small_file_name = $_FILES['small']['name']; $small_tmp_name = $_FILES['small']['tmp_name']; $destination = '../webisode_images'; if(!empty($small_file_name)) { if(move_uploaded_file($small_tmp_name,"$destination/$small_file_name")) { $sql .= ", small_file_name='$small_file_name' "; } } Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 do u need anymore information? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2009 Share Posted March 30, 2009 and the code that outputs the image? And what error do you get? Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 <?php $sql = "SELECT * FROM webisodes WHERE season=1"; $result =mysql_query($sql); while ($row=mysql_fetch_assoc($result)){ $title=$row['title']; $description=$row['description']; $video_large=$row['video_large']; $episode=$row['episode']; $small_file_name=$row['small_file_name']; $season=$row['season']; } ?> <a href="webisodes.php?season=<?=$season?>"><img src="<?=$small_file_name" title="<?=$title?>" alt="<?=$title?>" height="150px" width="150px" /></a> What the problem is... is that if you goto the url that the file was uploaded i get an 404 error from my hosting company saying that the file is not there. When I FTP into my account I see the files there. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2009 Share Posted March 30, 2009 You are uploading the files to ../webisode_images/$small_file_name. You are only putting $small_file_name in the the <img > tag. The only way that would work is if the second posted code was in webisode_images Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 woops i just noticed that too. I have before that "../webisode_images/" now. thats not the issue. I know the file paths are correct its just the images are not being uploaded correctly Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 Have you tried downloading an image through FTP and looking at it? If that works, it's a problem with paths. If not, it's a problem with uploading. Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 yea when i use FTP it works fine but when I use my form I just get sent to an error page Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 A 404 error page? Pretty sure your path is wrong then. Oh hrmmm.... Wonder if it is this: "<?=$small_file_name" You missed the closing ?>. It's bad practice to use short tags by the way since they're sometimes disabled on some servers. Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 Ok here is the link I goto and get the error This one was uploaded with the form: Form Uploaded This one was uploaded using FTP: FTP Uploaded I know ones a jpg and the other is a png but if I used the form to do the png it would still do the same. Also it says i need a index.html page? Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 And if you go into FTP and look at clients/webisodes/images/kp.jpg, it's there? Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 yup its very strange the path is clients/webisode_images/kp.jpg Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 Hrmmmm..... Does your host have some weird configuration? Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 thats what im trying to figure out...I have to wait till tommorow to contact them i thought maybe there was something wrong with my coding. Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 Omg.... It just occurred to me. File permissions. I'm not sure how it happened since the owner of the file should be the user running Apache, but I think it's a file permission error. Try changing the perms on kp.jpg. Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 Oh man i feel soo dumb right now. Sorry for wasting all this time on something so ridiculously easy! Man i feel like a rookie right now. Thanks for the brain refresh... Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 Ok but do i have to always go in there and change the permissions? Quote Link to comment Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 You should be able to chmod it. Quote Link to comment Share on other sites More sharing options...
waverider303 Posted March 30, 2009 Author Share Posted March 30, 2009 can you explain that a little more. Ive used this script a dozen times and i have never had to use chmod() Quote Link to comment 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.