Php: how to move uploaded images-php Tutorial

Source: Internet
Author: User
Php: how to move uploaded images


Reply to discussion (solution)

Move_uploaded_file ($ _ FILES ['photo '] ['tmp _ name'], $ target_image)
$ Target_image is the image address on the server, that is, the location you want to move

Move_uploaded_file ($ _ FILES ['photo '] ['tmp _ name'], $ target_image)
$ Target_image is the image address on the server, that is, the location you want to move



I'm talking about a folder that has been uploaded. How can I move it.

You can directly use php to call system commands,
Exec ("mv-f/path/old.jpg/path/new.jpg ");

You can directly use php to call system commands,
Exec ("mv-f/path/old.jpg/path/new.jpg ");



Is there no function method ???

Okay.
Rename ()
However, I always think that using system commands is faster, especially when processing large files.

Use the rename function.

Okay.
Rename ()
However, I always think that using system commands is faster, especially when processing large files.



Rename ("cs/temporaryPicture/". $ picturename [I], "cs/picture/". $ picturename [I]);

No. Always wrong

Use the rename function.



No, an error occurred.

What ???
Yes? Limit?

I want to hear from you!
What do you do? do you have to post the code?
If something goes wrong, do you have to give an error message?

I want to hear from you!
What do you do? do you have to post the code?
If something goes wrong, do you have to give an error message?



Warning: rename (cs/temporaryPicture/, cs/picture/) [function. rename]: No error in E: \ AppServ \ www \ test1 \ sendjobpicture. php on line 14

Use absolute paths. now you are using relative paths.

What ???
Yes? Limit?



Warning: rename (cs/temporaryPicture/, cs/picture/) [function. rename]: No error in E: \ AppServ \ www \ test1 \ sendjobpicture. php on line 14

Use absolute paths. now you are using relative paths.




Absolutely not.

Your $ picturename [I] is empty!

Cs/temporaryPicture/is the path, not the file (directory) name
How can this problem be solved?

Your $ picturename [I] is empty!

Cs/temporaryPicture/is the path, not the file (directory) name
How can this problem be solved?




Yes, it is empty. Oh, I understand. Thank you.

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.