I’m using the below code to upload member’s profile picture. As I’m new to php, I not able to capture where is the problem.
When i try to uplaod a file error shows:
"move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\Temp\phpF574.tmp' to '/profilepic/loader.gif'"
My code is below:
<?php
if(isset($_POST['pic'])){
$dir="/profilepic/";
$tmp_nm=$_FILES['profilepic']['tmp_name'];
$extension = pathinfo($_FILES['profilepic']['name'], PATHINFO_EXTENSION);
if (($extension !=="jpg") &&
($extension !=="jpeg") &&
($extension !=="png") &&
($extension !=="gif"))
{
exit('<div class="error" align="center">Unknown Image uploaded.</div> ');
}
$size=filesize($_FILES['profilepic']['tmp_name']);
if ($size > 200*1024)
{
$change='<div class="error">Maximum 200 KB Image Size allowed!</div> ';
}
$filename=$_FILES['profilepic']['name'];
@move_uploaded_file($tmp_nm, $dir.$filename);
$arr=array("profilepic='$filename'");
$class_database->update($arr, profile_table, "profileid='".$_SESSION['id']."'");
echo ('<div align="center" class="success">Uploaded your profile picture.</div>'.$php_errormsg);
}
?>
Also may anyone help me ?
Unable to move 'C:\Windows\Temp\phpF574.tmp' to '/profilepic/loader.gif'"usually means that you either don’t have permission to write to/profilepicor that directory doesn’t exist./profilepicdirectory actually exists.$_FILES['profilepic']['error']for anything other than 0