I have uploaded a file using HTML / PHP and following is the print_r() of the $_FILES['file'] array:
Array
(
[name] => Chrysanthemum.jpg
[type] => application/octet-stream
[tmp_name] => G:\xampp\tmp\php82DB.tmp
[error] => 0
[size] => 879394
)
As you can see above, the temp file is stored in the tmp_name directory. I need to get that directory path using PHP. How do I get it ?
Tried using sys_get_temp_dir()
but this is what it returns me.
I do NOT want to get the directory from the array or from the file upload data. I want to dynamically get the php file uploads directory using a function.
C:\Users\admin\AppData\Local\Temp
$tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With