This error might have occured on WordPress for you: “Image has failed to upload due to an error – Missing a temporary folder”.
Reason?
- It may be a permission issue for the php temporary folder
- The php temp folder may not exist.
Solution?
- Find the php.ini file for your webhost.
- Locate the temp folder
- Create the temp folder if it does not exist
- Give it proper permissions
In my case, I had transferred my site transhost, and hence this folder was actually missing.
My php.ini file (generated by i-mscp) was at this location: /var/www/fcgi/mysite/php5/php.ini
Once php.ini file was located, I needed to find the temp folder used by php:
#grep -in 'upload_tmp_dir' /var/www/fcgi/mydomain/php5/php.ini 875:upload_tmp_dir = "/var/www/virtual/mydomain//phptmp/"
Since this folder was missing, I created it and provided proper permissions and then restarted apache2:
#mkdir "/var/www/virtual/joel.co.in/phptmp/" #chmod 755 "/var/www/virtual/joel.co.in/phptmp/" #chown -R vu2003.www-data "/var/www/virtual/joel.co.in/phptmp/" #service apache2 restart
Now, I could upload media files again.
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.