Put method support
PHP provides support for the http put method used by some clients to store files on a server. PUT requests are much simpler than a file upload using post requests and they look something like this:
Put/path/filename.html HTTP/1.1
This wowould normally mean that the remote client wowould like to save the content that follows as:/path/filename.html in your web tree. it is obviusly not a good idea for Apache or PHP to automatically let everybody overwrite any files in your web tree. so, to handle such a request you have to first tell your web server that you want a certain PHP script to handle the request. in Apache you do this with the script directive. it can be placed almost anywhere in your Apache configuration file. A common place is inside a <directory> block or perhaps inside a <virtualhost> block. a line like this wocould do the trick:
Script put/put. php
Code
Example # 1 saving http put files
<? PHP
/* Put data comes in on the stdin stream */
$ Putdata = Fopen ( " PHP: // Input " , " R " );
/*Open a file for writing*/
$ Fp = Fopen("Myputfile. ext", "W");
/* Read the data 1 kb at a time
And write to the file */
While ( $ Data = Fread ( $ Putdata , 1024 ))
Fwrite ( $ Fp , $ Data );
/*Close the streams*/
Fclose($ Fp);
Fclose($ Putdata);
?>