PHP file upload error tmp_name is empty

It seems that your code does not have access to temp directory. 

This tutorial assumes that you are using Linux with apache server

Open php.ini file using following Command 


Note: if you are using another version of PHP please update PHP version in command accordingly If you don not know the the path of php.ini file  you can also find path of php.ini file which php command.

sudo nano /etc/php/8.1/apache2/php.ini

find "upload_tmp_dir" using ctrl + w and set your temp directory path 

Note: in apache it should be "/tmp/"

 



Final step is to give access (read and write )to you temp directory usign following command 


sudo chmod 1777 /tmp

 


Tags:

Share:

Related posts