I’m building a system, where user can upload a file as data (not for permanent storing, just the contents). Now I’m wondering whether it’s wise to grab the files contents from its temporary location provided by PHP, like this:
file_get_contents($_FILES['file']['tmp_name'])
Works fine on localhost, but I’m afraid there could be some permission-issues etc on hosting? Any help is appreciated.
The only chance for you to get the data is by reading the file given in the
'tmp_name'variable. There’s no other way to do it. PHP puts the file there for you, so you can be assured it’s readable. If it’s not, the server configuration is broken.