File upload with file, unable to find the solution in the TMP directory

Source: Internet
Author: User
Upload files with file, file not found in TMP directory
The code is as follows:


upload.php
if ($_files["file" ["error"] > 0)
{
echo "Return Code:". $_files["File" ["Error"]. "
";
}
Else
{
echo "Upload:". $_files["File" ["Name"]. "
";
echo "Type:". $_files["File" ["type"]. "
";
echo "Size:". ($_files["File" ["Size"]/1024). The Kb
";
echo "Temp file:". $_files["File" ["Tmp_name"]. "
";

if (file_exists ("upload/". $_files["File" ["Name"]))
{
echo $_files["File" ["Name"]. "already exists.";
}
Else
{
Move_uploaded_file ($_files["file"] ["Tmp_name"],
"Upload/". $_files["File" ["name"]);
echo "Stored in:". " Upload/". $_files["File" ["Name"];
}
}
?>

Operation Result:
Upload:jdk-6u34-windows-x64.exe
Type:application/octet-stream
size:61154.484375 Kb
Temp file:f:\xampp\tmp\phpcb11.tmp

Warning:move_uploaded_file (Upload/jdk-6u34-windows-x64.exe): Failed to open stream:no such file or directory in F:\XAMPP \htdocs\test\qwe.php on line 26

Warning:move_uploaded_file (): Unable to move ' F:\xampp\tmp\phpCB11.tmp ' to ' Upload/jdk-6u34-windows-x64.exe ' in f:\ xampp\htdocs\test\qwe.php on line 26
Stored In:upload/jdk-6u34-windows-x64.exe

Tangled for a long time, the platform environment is installed under the Windows Platform XAMPP integrated environment
and want to know why ....


------Solution--------------------
Directory upload does not exist
------Solution--------------------
Possible causes:
1. The path is not correct.
2. folder does not have permissions.
Add DirName (__file__) to see.


if (File_exists (DirName (__file__). /upload/". $_files["File" ["Name"]))
------Solution--------------------
Failed to open stream:no such file or directory
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.