File upload to MySQL

Codes here !

Moderators: egami, macek, gesf

Post Reply

Thu Jul 10, 2003 2:45 am


Have made a PHP script where I upload files to an SQL database. Unfortunately only partial files are uploaded and all have the same size: 32767 bytes. The field is mediumblob and should be able to hold larger files.

What are possible reasons for that? Could filesize be limited at my ISP ( in for example php.ini or my.cnf?


User avatar
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Thu Jul 10, 2003 10:21 am

moorstream wrote:Could filesize be limited at my ISP ( in for example php.ini or my.cnf?

Yep. It's likely the case that either post_max_size or upload_max_filesize in php.ini has been set to a lower value. To find out, use the phpinfo() function to show your configuration variables like so:

Code: Select all

<? phpinfo(INFO_CONFIGURATION); ?>

If that seems to be the problem, you can try to override the setting by using ini_set() at the beginning of your script, but that may or may not work. Also, don't forget that PHP looks for the contents of a hidden form field with the name MAX_FILE_SIZE. Try setting this to something higher.

It's also worth noting that if you plan on accessing the uploaded data frequently (if, for example, they are images that are part of the layout of your site), storing them in a database is less efficient than simply saving them as files.

Post Reply