File downloading problems

Source: Internet
Author: User
File upload problems I encountered when I click the "upload" button, the move_uploaded_file () problem occurs. My code: [code = PHP] [/code] for ($ I = 0; $ I & lt; count ($ filename); $ I ++) {if (move_uploaded_file ($ tmp file upload problems
My problem is that move_uploaded_file () occurs when you click upload.
My code:
[Code = PHP] [/code] for ($ I = 0; $ I If (move_uploaded_file ($ tmpname [$ I], $ file_path. $ tmpname [$ I]) = true ){
$ Insertsql = 'Insert into tb_upfile (filename, filepath, filetype, upanthor, chkdownnum, ispub) values ("'. trim ($ filename [$ I]). '","'. $ file_path. $ filename [$ I]. '","'. $ filetype [$ I]. '"," houqingdong ","'. trim ($ chkdownnum ). '",'. $ tmppub [$ I]. ')';
Try {
$ Dsn = "mysql: host = localhost; dbname = db_upan ";
$ Db = new PDO ($ dsn, "root ","");
$ Db-> exec ($ insertsql );
$ Db = null;
} Catch (PDOException $ e ){
Echo 'database operation error ';
}
} Else {
Echo "move_uploded_file error !! ";
}

}

The error message is:
Warning: move_uploaded_file (C: // xampp/htdocs/upan/upfile/C: \ xampp \ tmp \ phpD432.tmp) [function. move-uploaded-file]: failed to open stream: Invalid argument in C: \ xampp \ htdocs \ upan \ upfile_chk.php on line 33

Warning: move_uploaded_file () [function. move-uploaded-file]: Unable to move 'C: \ xampp \ tmp \ phpD432.tmp 'to 'C: // xampp/htdocs/upan/upfile/C: \ xampp \ tmp \ phpD432.tmp 'in C: \ xampp \ htdocs \ upan \ upfile_chk.php on line 33

------ Solution --------------------
The move_uploaded_file parameter has an error. you can check the output.
------ Solution --------------------
Path... Unable to move 'C: \ xampp \ tmp \ phpD432.tmp'
'C: // xampp/htdocs/upan/upfile/C: \ xampp \ tmp \ phpD432.tmp'
------ Solution --------------------
If (move_uploaded_file ($ tmpname [$ I], $ file_path. $ filename [$ I]) = true) {// save it as the original file name
------ Solution --------------------
If (move_uploaded_file ($ tmpname [$ I], $ file_path. $ tmpname [$ I]) = true)

Move_uploaded_file (File, new location)

Move_uploaded_file () is output first. check whether the path is correct.

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.