...

View Full Version : Help me "Warning: move_uploaded_file"



tomy
10-28-2009, 11:15 AM
I am getting this error in my code:


Warning: move_uploaded_file(../images/Image/product/480e5a9f_812.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/apple8/domains/apple8.vn/public_html/includes/function_admin.php on line 440

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phprtGs9z' to '../images/Image/product/480e5a9f_812.jpg' in /home/apple8/domains/apple8.vn/public_html/includes/function_admin.php on line 440






code:




function uploadFile($File, $FileCu, $path, $preFix, &$FileCapNhat, $LimitFileSize, &$err_flag, &$err_msg)
{

if ( $File['size'] < $LimitFileSize)
{
$FileCapNhat = $FileCu;

if ($File['name'] != '')
{
if (is_uploaded_file($File['tmp_name']) )
{
$FileCapNhat = $File['name'];

if (file_exists($path.$FileCapNhat))
{
$path_parts = pathinfo($FileCapNhat);
$baseName = $path_parts["basename"];
$extension = $path_parts["extension"];
$baseName = substr($baseName, 0, strlen($baseName) - strlen($extension) - 1);
while (is_file($path . $baseName . "_$preFix" . '.' . $extension)) $preFix++;
$FileCapNhat = $baseName . "_$preFix" . '.' . $extension;
}



if (move_uploaded_file($File['tmp_name'], $path . $FileCapNhat))
{
if (!empty($FileCu))
{
if (is_file($path . $FileCu))
{
unlink ($path . $FileCu);

}
}

}
}
else
{
$err_flag++;
$err_msg = 'File: "' . $File['name'] . '" must has size < ' . $LimitFileSize . " bytes (=2MB)";
}
}

}
else
{
$err_flag++;
$err_msg = 'File: "' . $File['name'] . '" must has size < ' . $LimitFileSize . " bytes (=2MB)";
}
}

seco
10-28-2009, 12:04 PM
check the permissions for these folders

images/
Image/
product/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum