I would like to upload a file from an html form, post it to PHP and load it into memory, bypassing writing it to a file. Is it possible to do a file upload and keep it in memory, or do I have to write it to a file?
Since PHP doesn't handle the actual HTTP requests itself (that's the web server's job) I can't imagine that this is possible. It would be awesome if somebody could prove me wrong though.
I do not think this is possible now. You can not use php://input with enctype="multipart/form-data", so that rules out opening the file from a stream. If you go the post route, you only can use the $_FILE variable, which does not contain any binary data, just the pointer to the file on disk.
It looks like xforms will help (http://www.ibm.com/developerworks/xml/library/x-xformstipuploadphp/index.html) but this is in even Firefox 3.5. It requires a plug-in, which is a deal killer for me.
The PUT option is cool. If you wanted to use POST and $_FILES, I think the closest you could get would be to point upload_tmp_dir
at a ramdisk.