Here is my code:
if (!empty($_FILES['userfile']['tmp_name']))
{
$fs = filesize($_FILES['userfile']['tmp_name']);
$HTTP_POST_FILES['userfile']['name'];
if($fs>200000) //200KB
{
$error= "You picture size is great than 200KB. Upload is canceled.";
}
else
{
if(!is_dir("C:/user/image/$member")) //dir does not exist
mkdir ("C:/user/image/$member", 0700);
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], "C:/user/image/$member/$item_name.jpg"))
echo "File failed to move";
else
{
//$userfile_type = $HTTP_POST_FILES['userfile']['type'];
//echo "type >> $userfile_type";
$sql = "insert into furniture values ('$member', '$item_name', '$quality', '$price', '$other', CURDATE(), 'C:/user/image/$member/$item_name.jpg')";
if (! @mysql_query($sql))
echo "<p>Error in adding: mysql_error(). </p>";
}
}
}
I just began to doubt that if this: 'mkdir ("C:/user/image/$member", 0700);' is the cause of the problem. Should I set it as 0777?
When I test the webpage on a client machine, the image that is supposed to be shown only has a cross on a rectangle, and I go back my own machine, I saw the image has been successfully uploaded and moved to the desinated directory. So I thought the problem came from the path, but I'm not 100% sure.
Thanks.