Home  >  Article  >  Backend Development  >  How to convert remote files to $_FILES in PHP?

How to convert remote files to $_FILES in PHP?

WBOY
WBOYOriginal
2016-07-06 13:51:191718browse

I have a remote file address:

localhost/1.zip

I have a function to upload files. The default is to upload files through POST. You must pass in $_FILES

How can I change this 1.zip into $_FILES without form submission?

Reply content:

I have a remote file address:

localhost/1.zip

I have a function to upload files. The default is to upload files through POST. You must pass in $_FILES

How can I change this 1.zip into $_FILES without form submission?

@Hoyt It cannot be implemented. Even if it is implemented, this is not a scientific way to solve the problem. If you just want to upload a remote file to other sites, just use CURL directly.

When you encounter a problem and find that there is no solution, you should first think about whether the demand is too weird, or whether your design itself is defective or unreasonable, such as your function for uploading files. , if you are downloading files remotely, you should not perform the upload action but the download action, and then store them uniformly,

The poster can take a look at this idea to solve the problem x-y problem http://coolshell.cn/articles/10804.html

You can refer to this: http://blog.csdn.net/xuzuning/article/details/7444709

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn