shamsuljewel Posted September 16, 2007 Share Posted September 16, 2007 I cannot upload pic!!!! It was ok on php4 when I used phptriad. but I am now using php5 with apache mysql5...and the same code doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/69542-upload-picture/ Share on other sites More sharing options...
Casalen Posted September 16, 2007 Share Posted September 16, 2007 What is the code? Post at least some of it here. What error messages show up? Quote Link to comment https://forums.phpfreaks.com/topic/69542-upload-picture/#findComment-349434 Share on other sites More sharing options...
shamsuljewel Posted September 16, 2007 Author Share Posted September 16, 2007 there is no error message...but the file does not go the server where I placed. Quote Link to comment https://forums.phpfreaks.com/topic/69542-upload-picture/#findComment-349437 Share on other sites More sharing options...
redarrow Posted September 16, 2007 Share Posted September 16, 2007 Have you cheek your php.ini for max_upload size. are u using $_POST[' '] OR $_GET[' '] Quote Link to comment https://forums.phpfreaks.com/topic/69542-upload-picture/#findComment-349438 Share on other sites More sharing options...
shamsuljewel Posted September 16, 2007 Author Share Posted September 16, 2007 Yes I configure php.ini and use $POST['userfile'] too. $userfile = $_POST['userfile']; if($userfile != "") { $err = 0; echo $userfile; if($userfile_type != "image/gif" && $userfile_type != "image/jpeg") { echo "<script language='javascript'>alert('Sorry!!! Pic type not Supported!!!');history.back(-1);</script>"; $err=1; } else { $maxSize=4; $maxWidth=150; $maxHeight=150; list($width, $height, $imgType, $str)=getimagesize($userfile); if($height > $maxHeight || $width > $maxWidth) { echo "<script language='javascript'>alert('Dimension of Image Must not exceed $maxWidth X $maxHeight!!!');history.back(-1);</script>"; $err=1; } else if($userfile_size > (1024*$maxSize)) { echo "<script language='javascript'>alert('Sorry Pic Must not be bigger than $maxSize kb!!!');history.back(-1);</script>"; $err=1; } } if(err==0) { echo "no error"; //@move_uploaded_file($userfile, "pic/user_pic_ami.gif") or die("Could not upload!"); //@copy($_FILES[userfile][tmpname],"pic/".$_FILES[userfile][mainname]) or die("Could not copy the file."); echo $row["id"]; echo $userfile; if(!@move_uploaded_file($userfile, $pic="pic/user_pic_".$row["id"].".gif")) { echo "<script language='javascript'>alert('Sorry!!! File Cannot be Uploaded!!! all other information updated ');history.back(-1);</script>"; } } } Quote Link to comment https://forums.phpfreaks.com/topic/69542-upload-picture/#findComment-349439 Share on other sites More sharing options...
shamsuljewel Posted September 16, 2007 Author Share Posted September 16, 2007 thanks I have solved it... Quote Link to comment https://forums.phpfreaks.com/topic/69542-upload-picture/#findComment-349465 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.