patheticsam Posted May 2, 2009 Share Posted May 2, 2009 Hi! I have a problem with a php upload script. It's really weird cause when I test it with one hoster (runhosting.com) it works perfectly and when I try it on another hoster (that I just signed up with) I can't seem to get the picture uploaded. The hoster i'm with runs under unix with PHP 5 activated. I 've set the upload folder permissions to 777 and still dosen't works..... Here's the upload script I have (upload.php) : <?php if ($userfile_size >250000){$msg=$msg."Your uploaded file size is more than 250KB so please reduce the file size and then upload. Visit the help page to know how to reduce the file size.<BR>"; $file_upload="false";} if (!($userfile_type =="image/pjpeg" OR $userfile_type=="image/gif")){$msg=$msg."Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>"; $file_upload="false";} $add="pictures/$userfile_name"; if(move_uploaded_file ($userfile, $add)){ echo "<center>File successfully uploaded</center>"; }else{echo "Failed to upload file Contact Site admin to fix the problem";} ?> and here's my form (form.html) : <FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST name=upload> <br><br> <table border=0 cellpadding=0 cellspacing=0 width=425 align=center> <tr> <td width=250 height=35><b>Name :</b></td> <td align=right><input type="text" name="email" size=43 class="texta"></td> </tr> <tr> <td width=250 height=35 bgcolor="D8D8D8"><b>Phone number :</b></td> <td align=right bgcolor="D8D8D8"><input type="text" name="phone" size=43 class="texta"></td> </tr> <tr> <td width=250 height=35><b>Picture</b></td> <td align=right><input NAME="userfile" TYPE="file" class="texta" size=29> </td> </tr> <tr><td colspan=2 align=right><br><br><b>2 / 2 </b><input name=submit type="submit" value="Submit ad"></td></tr> <tr> </table> </form> If anyone can help with this issue it would be greatly appreciated! Thank you Quote Link to comment https://forums.phpfreaks.com/topic/156598-solved-problem-with-upload-form-please-help/ Share on other sites More sharing options...
Philip Posted May 2, 2009 Share Posted May 2, 2009 Is it throwing any errors, and do you have stuff like error_reporting(E_ALL); at the top of your script? Quote Link to comment https://forums.phpfreaks.com/topic/156598-solved-problem-with-upload-form-please-help/#findComment-824537 Share on other sites More sharing options...
patheticsam Posted May 2, 2009 Author Share Posted May 2, 2009 I have error_reporting(E_ALL); at the very top of the script but I don't get any error. The only thing I have is the "Failed to upload file Contact Site admin to fix the problem" returned by the If/else statement.....Just I as I said I just can't undertant why this script works at runhosting and not at my new hoster....(?) Quote Link to comment https://forums.phpfreaks.com/topic/156598-solved-problem-with-upload-form-please-help/#findComment-824539 Share on other sites More sharing options...
patheticsam Posted May 2, 2009 Author Share Posted May 2, 2009 At least if someone know another little script that could do the job it would be really cool! Thanx! Quote Link to comment https://forums.phpfreaks.com/topic/156598-solved-problem-with-upload-form-please-help/#findComment-824566 Share on other sites More sharing options...
patheticsam Posted May 3, 2009 Author Share Posted May 3, 2009 Found it myself. still thanx! Quote Link to comment https://forums.phpfreaks.com/topic/156598-solved-problem-with-upload-form-please-help/#findComment-824579 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.