Jump to content

Can someone help me know what is wrong with this code. it does not uplaod picture to server.


Recommended Posts

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

 

=======================

<?php

include '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`
set
pix='$file'
where `user_id`='$id'
");


if (!$z ) {
echo "<script>alert('Update Not Successful')</script>";
}else{



}
}
 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.