Remote File Download to space using PHP

Source: Internet
Author: User
I just moved to the blog and planned to migrate the data in two spaces. but when something went wrong, I thought that PHP could download the file remotely and write a script! 01 & lt ;? Php02if ($ _ GET [xfer]) {03if ($ _ POST [from] & quot;) {04 print & quot; Youfor... I just moved to the blog and planned to migrate the data in two spaces. but when something went wrong, I thought that PHP could remotely download files when the packaged files were too large.
Then I wrote a script!
01
02 if ($_GET[xfer]) {
 
03 if ($_POST[from] == "") {
04 print "You forgot to enter a url.";
 
05 } else {
06 copy("$_POST[from]", "$_POST[to]");
 
07 $size = round((filesize($_POST[to])/1000000), 3);
08 print "transfer complete.
 
09 $_POST[from]
10 $_POST[to] : $size MB";
 
11 }
12 } else {
 
13 print "
14 Remote File (please include http ://):
 
15 Save File name:
16 ";
 
17 }
18 ?>
However, not all virtual hosts support this function. you have to check whether some functions are enabled. I don't know what functions are supported.
 

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.