How to get file temporary path in php while file upload
I am using Uploadify jQuery plugin for file upload.Here there is no browse button used. it will upload the file using ajax on click event.So There is no file temp path is displaying.So i want to make it display.
So, I try to get file temp path using $_FILES['uploadfile']['tmp_name']. But it just return something like this /tmp/phpclqHXj.But i want display actual temp path like C:\Users\Diamantino\Desktop\file.jpg.Can i get this using php. any option in uploadify plugin, anyway to get jquer开发者_JAVA技巧y or js.Any help would be appreciated.
My Browse button.
Thanks
There is no way to get the full path to the file from your user's computer. You can get the file name (in your example that would be "file.jpg"
) using $_FILES['uploadfile']['name']
. Security issues would arise if you could get information about your user's local folder structure when they upload a file, so web browsers are very unlikely to send that data. If there is some browser that does send it, it won't appear in the $_FILES
superglobal, nor will there be any other easy way to access is in php.
At the very least, you're looking for the filename found under:
$_FILES['uploadfile']['name']
Instead of C:\Users\Diamantino\Desktop\file.jpg, this will return the filename: file.jpg
However, with the use of simple Javascript, you may be able to accomplish getting the entire file path. With some logic on your end, you may be able to get the file path only when the file is uploaded. Here is an example, and some clarity on implementation.
精彩评论