Using the downloaded file without saving to the server disk

I created a PHP script to upload a file, unfortunately I do not have permission to save files to disk. I need to download an excel file (using phpexcel), then I have to read all the lines in the file and save to disk. Is there a way to process this file without saving to disk, I tried to read $_FILES['file1']['tmp_name'] but it does not work.

Can anyone suggest a method for processing this file

Thanks for attention

+4
source share
3 answers

Under "save to disk" do you want to send it to the user to download it?

Usually you should have write access to (at least) the temporary directory of PHP. Have you tried to run the form and script in the local environment? Maybe something is wrong with the download ?!

Finally: Why don't you have access to files? Is it possible to create a subpixel file below a PHP file (via FTP) and give it full permissions?

+4
source

I tried to read $ _FILES ['file1'] ['tmp_name']

most likely you just encountered an error.
what often happens to novice programmers

you need to fix this error instead of looking for odd workarounds.
Start by checking $_FILES['file1']['error']

what

 var_dump($_FILES['file1']['error']); 

to tell?

+2
source

Instead of sending your files using the form (multidata over HTTP POST), you can send your files using Javascript using the HTTP PUT method to your server.

This scenario is described in the official PHP documentation -> PUT Method Support .

Due to some of the limitations described in the documentation, you have to take some workarounds in order to be able to work correctly.

You can read the direct input stream from your web server. Data will be transferred from your web server to your PHP program and will only be stored in memory. To make an Ajax PUT call with jQuery, an answer was received here . You can use the plugin to download jQuery like Uploadify .

0
source

All Articles