Hi Friend

image Uploading is working well in localhost working with WAMP SERVER 2.0.
Also i am able to access the stored image easily from the directory in offline


BUT
While working online only the path is getting updated in database
but the file is not uploading to specified directory.

Specified path and directory name is correct...

Dont Know what the problem is

Help Me Please...

Do you have permissions setup to allow file uploads?

can you please post your code

error_reporting(0);

$change="";
$abc="";


 define ("MAX_SIZE","4096");
 function getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }

 $errors=0;

 if($_SERVER["REQUEST_METHOD"] == "POST")
 {
    $image =$_FILES["passfoto"]["name"];
    $uploadedfile = $_FILES['passfoto']['tmp_name'];


    if ($image) 
    {

        $filename = stripslashes($_FILES['passfoto']['name']);

        $extension = getExtension($filename);
        $extension = strtolower($extension);


 if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) 
        {

            $change='<div class="msgdiv">Unknown Image extension </div> ';
            $errors=1;
        }
        else
        {

$size=filesize($_FILES['passfoto']['tmp_name']);


if ($size > MAX_SIZE*1024)
{
    $change='<div class="msgdiv">You have exceeded the size limit!</div> ';
    $errors=1;
}


if($extension=="jpg" || $extension=="jpeg" )
{
$uploadedfile = $_FILES['passfoto']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);

}
else if($extension=="png")
{
$uploadedfile = $_FILES['passfoto']['tmp_name'];
$src = imagecreatefrompng($uploadedfile);

}
else 
{
$src = imagecreatefromgif($uploadedfile);
}



list($width,$height)=getimagesize($uploadedfile);


$newwidth=100;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);


$filename = "nw imgs/". $mem_id.".".$extension;


move_uploaded_file($_FILES['passfoto']['tmp_name'], "nw imgs/" .$_FILES['passfoto']['name']);//tried with this also

imagejpeg($tmp,$filename,100); 



imagedestroy($src);
imagedestroy($tmp);
//imagedestroy($tmp1);
}}

}

//If no errors registred, print the success message
 if(isset($_POST['Submit']) && !$errors) 
 {

   // mysql_query("update {$prefix}users set img='$big',img_small='$small' where user_id='$user'");
    $change=' <div class="msgdiv">Image Uploaded Successfully!</div>';
 }

Its uploading the file and updating the database successfully in local server..

But online uploading is not working..

move_uploaded_file($uploadedfile, 'nw imgs/' .$_FILES['passfoto']['name']);[

try this...

The Php version in local wamp server i am using is PHP Version 5.3.0.

And the version in plesk server is PHP Version 5.2.6...


Will this Vresion difference will make any problem in uploading the file..?

How can iover come that problem..

Bad response (unexpected). Thanks to daniweb members...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.