WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress Plugin Development Can't Upload Image To Database (1 post)

  1. -JFK-
    Member
    Posted 4 years ago #

    All.

    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:

    PHP.ini

    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 120M
    ; Maximum size of POST data that PHP will accept.
    post_max_size = 100M

    MY.ini

    key_buffer_size=25M
    max_allowed_packet=16M

    GOOD LUCK and I hope this helps someone else!

Topic Closed

This topic has been closed to new replies.

About this Topic