I cannot upload files. I am trying to upload files. the following error occurs: Warning): failedtoopenstream: NosuchfileordirectoryinE: wwwloginupload. phponline28Warning: mo. I cannot upload files.
When I try to upload a file, an error occurs:
Warning: move_uploaded_file (upload/201006202425103745.png): failed to open stream: No such file or directory in E: \ www \ login \ upload. php on line 28 Warning: move_uploaded_file (): Unable to move 'C: \ WINDOWS \ Temp \ php89.tmp 'to 'upload/201006202379103745.png' in E: \ www \ login \ upload. php on line 28 save picture failed
My code:
If ($ _ SERVER ['request _ method'] = 'post ')
{
If (! Is_uploaded_file ($ _ FILES ['file'] ['tmp _ name'])
{
Echo "fasgsdf ";
Exit;
}
If ($ _ FILES ["file"] ["type"] = "image/gif") |
($ _ FILES ["file"] ["type"] = "image/jpeg") |
($ _ FILES ["file"] ["type"] = "image/jpg") |
($ _ FILES ["file"] ["type"] = "image/gif") |
($ _ FILES ["file"] ["type"] = "image/png") |
($ _ FILES ["file"] ["type"] = "image/bmp ")) & ($ _ FILES ["file"] ["size"] <20000 ))
{
If (file_exists ("upload/". $ _ FILES ["file"] ["name"])
{
Echo "picture already exist ";
}
Else
{
$ Result = move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "upload/". $ _ FILES ["file"] ["name"]);
If ($ result)
Echo "save picture fuccessful ";
Else
Echo "save picture failed ";
}
}
Else
{
Echo "invalid file ";
Exit;
}
}
?>
Html section:
Script
Function uploadpic ()
{
Var form = document. getElementById ("form1 ");
Form. submit ();
}
Script
------ Solution --------------------
The path is incorrect. There is no upload folder in the current directory, right ??
------ Solution --------------------
Because there is no folder