tmp_name is empty wordpress php image upload ?

If your getting tmp_name value empty in word press php image upload ,it is because of temp directory path issues you can solve by using following steps.

1) By using FTP or hosting create a php.ini file in root folder(don’t create if that file already their means.)

2) Add below line in that php.ini file

i) upload_tmp_dir= /home/username/public_html/temp/ ( /home/username/public_html= root path)

ii) Create a folder temp( in root ditectory and give full permission)

3) Now you can use same PHP upload script to upload your image

if (move_uploaded_file($_FILES[“fileToUpload”][“tmp_name”], $target_file)) {
echo “The file “. basename( $_FILES[“fileToUpload”][“name”]). ” has been uploaded.”;
} else {
echo “Sorry, there was an error uploading your file.”;
}

Cheers 🙂

5 thoughts on “tmp_name is empty wordpress php image upload ?”

Leave a Reply

Your email address will not be published. Required fields are marked *