[Resolved] WordPress Plugin Development Can’t Upload Image To Database
So, I just spent WAY too long trying to fix a problem and I finally did it! Just in case there are others out there trying to do the same thing and can’t find the answer online… well, now… here it is.
I am writing my own custom plugin to be used with WordPress MU 2.9.2.
My plugin allows a ADMIN panel that users can upload an image that will be stored into its own table in MySQL database (under WordPress MU scheme). I have written a matching Widget that will then pull the related images directly from the database and display to website visitors.
The problem I was having was… I could upload images into via my WordPress ADMIN panel screen that were less than approx 60 Kb (kilobytes) in size. Anything over that… just didn’t do anything. It was like I never made the form POST. For the longest time I thought it had to do with my PHP file upload limits (which do need to be set). In the end, it turned out I was using a MySQL database field “BLOB” that is only 64K in size. So, I changed my database field from “BLOB” to “MEDIUMBLOB” and IT WORKED!!! “MEDIUMBLOB” has size of 16MB and “LONGBLOB” has 4GB. Thanks to the following URL I found that on: http://osdir.com/ml/php.database/2002-06/msg00020.html
Also, make sure you have the appropriate settings for the following files:
; Maximum allowed size for uploaded files. upload_max_filesize = 120M ; Maximum size of POST data that PHP will accept. post_max_size = 100M
GOOD LUCK and I hope this helps someone else!
- The topic ‘[Resolved] WordPress Plugin Development Can’t Upload Image To Database’ is closed to new replies.