reid_ron Posted August 20, 2013 Share Posted August 20, 2013 When trying to upload a picture file it goes error:Failed to upload file. Contact Site admin to fix the problem What am I doing wrong ======================= <?phpinclude 'db.php';$id=@$_GET['id'];$ya=mysql_query("select * from `registeronline` where user_id='$id'");$yb=mysql_fetch_array($data);$val= '$id'+2400241106;if (!isset($_POST["Submit"])) {echo "";}else{$file=@$_POST['pix'];if (isset($HTTP_POST_FILES["pix"])){ $upload_type =$HTTP_POST_FILES["pix"]["type"]; $upload_name=$HTTP_POST_FILES["pix"]["name"]; $upload_size=$HTTP_POST_FILES["pix"]["size"]; $upload_tmp_name=$HTTP_POST_FILES["pix"]["tmp_name"]; } else { echo "" ; } 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="upload/$userfile_name"; // the path with the file name where the file will be stored, upload is the directory name.if(move_uploaded_file ($userfile, $add)){// Your Picture has been uploaded successfully.}else{echo "Failed to upload file. Contact Site admin to fix the problem";} $z=mysql_query("update `registeronline`setpix='$file'where `user_id`='$id'");if (!$z ) {echo "<script>alert('Update Not Successful')</script>";}else{}} Quote Link to comment https://forums.phpfreaks.com/topic/281383-can-someone-help-me-know-what-is-wrong-with-this-code-it-does-not-uplaod-picture-to-server/ Share on other sites More sharing options...
Barand Posted August 20, 2013 Share Posted August 20, 2013 Don't use code that was deprecated 10 years ago. http://php.net/manual/en/features.file-upload.php Quote Link to comment https://forums.phpfreaks.com/topic/281383-can-someone-help-me-know-what-is-wrong-with-this-code-it-does-not-uplaod-picture-to-server/#findComment-1445943 Share on other sites More sharing options...
reid_ron Posted August 20, 2013 Author Share Posted August 20, 2013 can you help me fix this. What should I do? Quote Link to comment https://forums.phpfreaks.com/topic/281383-can-someone-help-me-know-what-is-wrong-with-this-code-it-does-not-uplaod-picture-to-server/#findComment-1445947 Share on other sites More sharing options...
ShivaGupta Posted August 20, 2013 Share Posted August 20, 2013 post ur code in code aria.use this <> for code posting. Quote Link to comment https://forums.phpfreaks.com/topic/281383-can-someone-help-me-know-what-is-wrong-with-this-code-it-does-not-uplaod-picture-to-server/#findComment-1446037 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.