2007-10-05

Uploaded file is to large

PHP has a setting in the php.ini named upload_max_filesize. If your uploaded file is larger, you will get an error code in the $_FILES array. But here is another limit. If post_max_size is to small for the uploaded data, you will get emtpy $_FILES and $_POST arrays. So how to output an error message for the user? I found $_SERVER['CONTENT_LENGTH']. It contains the byte length of the content.
...
if (isset($_SERVER['CONTENT_LENGTH']) &&
   $_SERVER['CONTENT_LENGTH'] >
     $this->iniGetSize('post_max_size')) {
 $this->addMsg(MSG_ERROR,
   $this->_gt('Uploaded data is to large.'));
}
...
Does anybody know a better solution or problems with that one?

2007-09-28

Upload Files

Finally we got an upload progress bar in the new media database using the uploadprogress extension. Looks nice, doesn't it?

The Javascript extends the used form with an onsubmit event to track the progress. So the upload still works without JS.

2007-09-03

Database debugging in Firebug

After I got the php errors in Firebug I still had some ugly debug outputs in my pages - the database errors and explains. Some lines later I got new data in Firebug.


Thanks Firebug - Web Development Evolved!
x