开发者

How do I create a PHP page which can accept file uploads?

开发者 https://www.devze.com 2023-02-28 09:31 出处:网络
I want to upload a file to m开发者_如何学JAVAy server from some application. How can I code a PHP page to accept this file?The application should just include the file in an HTTP POST request as would

I want to upload a file to m开发者_如何学JAVAy server from some application. How can I code a PHP page to accept this file?


The application should just include the file in an HTTP POST request as would an HTML form with an input of type file. In the PHP code, the posted file contents would be available in the $_FILES array.

Lots more information here.

Keep in mind that the concept of a "file" doesn't mean the same thing over HTTP that it does on a local computer or on the target server. In HTTP, the "file" is just a stream of data wrapped in an HTTP request or response with a given content type and various other headers, no different from a web page or an image or any other request/response.


I would suggest reading the PHP manual chapter on handling file uploads

0

精彩评论

暂无评论...
验证码 换一张
取 消