This is the PHP upload file code, how to change the upload directory

Source: Internet
Author: User
Tags save file
foreach ($_files as $f)
{
Working with Chinese names
if (function_exists ("Iconv")) $f [Name] = Iconv ("UTF-8", "GB2312", $f [name]);
Check if a file with the same name already exists
if (file_exists ($f [name])) header ("http/1.0 403");
Save File
if (! @move_uploaded_file ($f ["Tmp_name"], $f [name]) header ("http/1.0 404 Not Found");
echo "1";
}
How to change the upload directory to d://www this folder?


Reply to discussion (solution)

Move_uploaded_file ($f ["Tmp_name"], ' d:/www/'. $f [name])

Move_uploaded_file ($f ["Tmp_name"], ' d:/www/'. $f [name])


How do I get the file name? For example, the file name is a.txt. Get Results $name = a

$name = PathInfo (' a.txt ', pathinfo_filename); Echo $name;

I don't know what you're talking about.

$name = PathInfo (' a.txt ', pathinfo_filename);
Echo $name;

  • 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.