PUT Method Requests - PHP

The PUT method is an HTTP request for a file to be placed on the remote server. It's like a file upload that doesn't come from a form and tells you where to place the file in your document tree. You might guess that this is a very dangerous thing to allow for anonymous users. It's especially dangerous when users could be uploading PHP scripts.

Not all browsers support PUT requests, and neither do all servers. Netscape Composer and the W3C's Amaya browsers reportedly allow PUT requests. Apache for UNIX will accept them if configured to do so. To configure Apache to allow PUT requests, you use
the Script directive inside a configuration file. You could tell Apache to run all PUT requests through a PHP script with a line like Script PUThandle_put.php in httpd.conf.

The PHP_UPLOADED_FILE_NAME variable will be set with the path to the uploaded file, which will be in a temporary directory. Just as with file uploads using the POST method, this file will be automatically deleted when your script ends if you don't move it. If you need to know the requested URI, look in the REQUEST_URI variable.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

PHP Topics