With Apache/PHP5, can you really obtain the items in an submitted file directly without getting it written towards the file system?

Very little on the internet relating to this, however it seems that files will always be written to some temporary directory after they are submitted.

Unsure i realize you, however i will attempt to reply to.

http://www.w3schools.com/PHP/php%5Ffile%5Fupload.asp

What you could learn here's that each file is submitted to php's temp directory. Then its as much as your script to maneuverOrduplicate that file with a permanent web accessible directory, because file which was submitted to php's temp dir is erased following the script finish performing.

On Linux you may create filesystem partitions in memory. If you're able to be sure that the submitted file is written towards the partition in memory, if is going to be saved in memory but behave as whether it were saved within the filesystem, making both Apache/PHP5 and also you happy.

However , any solution which creates files to memory instead of towards the filesystem requires severe restrictions around the size and volume of the files. You will notice a speed boost by staying away from conntacting disk, but when you utilize enough memory to push other data in to the pagefile or swap, your "optimisation" will end up detrimental very rapidly.

You are able to:

<?php
if (!empty($_FILES))
{
    echo "<pre>";
    print_r($_FILES);
    echo file_get_contents($_FILES['file']['tmp_name']);
    echo "</pre>";
}
?>
<form id="myForm" method="post" enctype="multipart/form-data">
    <input type="file" name="file" />
    <input type="submit" value="Send" />
</form>

Output:

Array
(
    [file] => Array
        (
            [name] => mytextfile.txt
            [type] => text/plain
            [tmp_name] => D:\PHP\wamp\tmp\php1283.tmp
            [error] => 0
            [size] => 1473
        )

)
My text file My text file My text file My text file My text file My text file 
My text file My text file My text file My text file 
My text file My text file My text file My text file My text file My text file 
My text file My text file My text file 
My text file My text file My text file My text file My text file

I'm not sure whether it's restricted by some php.ini variable.