Question

I pasted my codes HERE in Pastebin.

Thing is that, I have posts, where the post thumbnail is the first image and the custom fields are used to store the other 3 images of the post. The form fields are working, because I could change/edit the fields, but the problem is with the media uploader. By the time I'm uploading an image it's not taking the image, but storing an error message to the database:

O:8:"WP_Error":2:{s:6:"errors";a:1:{s:12:"upload_error";a:1:{i:0;s:212:"File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.";}}s:10:"error_data";a:0:{}}

But I used advanced custom fields plugin, and that's working properly with the same image, and the WordPress default media uploader is working too with the same image file. So, I think there is no restriction like max_filesize in my localhost. And also, I tried this on the server, and it's till working the same.

I failed to upload an image.

What's the problem in my code?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top