webtuto Posted June 8, 2009 Share Posted June 8, 2009 hi , i made a website where the admin can add photos to his page like an image gallery so there are two pages where the admin is able to ad d these photos the first one , everything is OK , the photo get uploaded succusfuly but on the other page the upload fail !!!!!!! even if its the same code i gave chmod777 to the photos file any help is appreciated thanks Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/ Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 I have no idea... Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851534 Share on other sites More sharing options...
jxrd Posted June 8, 2009 Share Posted June 8, 2009 Yeah, it's because you have a missing semi-colon on line 45. Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851535 Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 Your buffer is backwards... Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851538 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 how do you know about line45 , you didnt even saw the code ! Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851541 Share on other sites More sharing options...
jxrd Posted June 8, 2009 Share Posted June 8, 2009 Exactly, so post it then. Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851542 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 what do u mean my buffer is backward ? Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851543 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 the problem is not frrom the code the problem is from something else because i have two pages the first one this code work succusfuly and the other one no ? and in my computer the two of theme WORKED but when i host it on my host , it didnt wanna upload the photo you see the problem ?? Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851545 Share on other sites More sharing options...
jxrd Posted June 8, 2009 Share Posted June 8, 2009 How do you expect us to know WITHOUT THE CODE? Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851550 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 bcz its not a pr oblem of code In my local , it work , but when i hosted it , it didnt work ? so its not a problem of code , you see the problem Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851552 Share on other sites More sharing options...
jxrd Posted June 8, 2009 Share Posted June 8, 2009 Omg... No. How would I know what the problem is? Read over this thread, and pretend you're me, who doesn't know anything about your problem. Do you understand? You haven't given any details, code, or examples. Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851556 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 thats the code $width = 110; $height = 83; $thumb = "thumbs/"; $tmp = $_FILES['photo']['tmp_name']; $name = $_FILES['photo']['name']; $destination = "photos/"; $upload = move_uploaded_file($tmp , "$destination$name"); createThumbnail($name); if($upload) { echo "<br />"; echo "[ <a href='../showit.php?id=$_GET[id]'>Retourner ]</a>"; } Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851562 Share on other sites More sharing options...
jxrd Posted June 8, 2009 Share Posted June 8, 2009 And what error are you getting, or what's not happening like you expect it to? Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851565 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 im not getting any error i expect that the photo get uploaded , but its not :s and this same code is working on my LOCAL Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851569 Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 What version of PHP is running on each server? What's the code for the "createThumbnail" function? Most likely you're trying to use some function on your remote hosting that is either disabled, or not available with that version of PHP. Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851570 Share on other sites More sharing options...
jxrd Posted June 8, 2009 Share Posted June 8, 2009 Also, you may want to turn on error reporting. You probably are getting an error, you just can't see it. Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851573 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 i dont know how to know the version maybe its 4 and no the function is working on my hosting , b ecause the same exact code work on another PAGE !!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851575 Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 <?php phpinfo(); ?> That will tell you what version is running, put it in a file and run on both servers. Why do you run the exact same code on 2 pages? Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851578 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 i made the php info thing and here is the result --> http://www.webzik.com/maison/info.php i run the same exact code on 2 pag es because the admin can add the photo from his administration or directely on the same page as the article Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851580 Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 Fair enough. Also, you may want to turn on error reporting. You probably are getting an error, you just can't see it. Add: ini_set('display_errors', 1); error_reporting(E_ALL); To the very top of your script. Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851586 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 it gives this error Notice: Undefined variable: tn in /home2/gozikcom/public_html/webzik/maison/functions/functions1.php on line 36 here is the function code <?php function createThumbnail($name) { $destination = "photos/"; $width = 110; $height = 83; $thumb = "thumbs/"; require 'includes/config.php'; if(preg_match('/[.](jpg)$/', $name)) { $im = imagecreatefromjpeg($destination . $name); } else if (preg_match('/[.](gif)$/', $name)) { $im = imagecreatefromgif($destination . $name); } else if (preg_match('/[.](png)$/', $name)) { $im = imagecreatefrompng($destination . $name); } $ox = imagesx($im); $oy = imagesy($im); $nx = $width; $ny = $height; $nm = imagecreatetruecolor($nx, $ny); imagecopyresized($nm, $im, 0,0,0,0,$nx,$ny,$ox,$oy); if(!file_exists($thumb)) { if(!mkdir($thumb)) { die("Y'as un probleme , essaye encore!"); } } imagejpeg($nm, $thumb . $name); echo $tn; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851597 Share on other sites More sharing options...
jxrd Posted June 8, 2009 Share Posted June 8, 2009 echo $tn; You're not setting $tn anywhere. Although I doubt that's causing the upload problem. Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851601 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 no its not causing the upload problem because on my local its the same error and it get uploaded :s Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851603 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 so any solution?? Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851610 Share on other sites More sharing options...
webtuto Posted June 8, 2009 Author Share Posted June 8, 2009 ??????????????????????????????????????????????????????????? Quote Link to comment https://forums.phpfreaks.com/topic/161369-uploading-photos-problem/#findComment-851617 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.