Support

  1. ruud
  2. General
  3. Thursday, December 04 2014, 11:23 AM
Hi,

been helping a user upload her avatar. It turned out that the avatar file size was to big, which is strange.
Investigated it and found a potential issue in your code and have an improvement suggestion.

When specifying the upload_max_filesize in php.ini it is allowed to use a Shorthand notation.
In my case i have set this value to 1G

In your code you read the value $max_upload = (int)(ini_get('upload_max_filesize'));
and evaluate the uploaded file size like this: } else if ( $image['size'] > $upload_limit*100*100*100 ) {

what happens is that the maximum file size limit is not 1G but appr. 1M (because you multiply 1 by 100 * 100 * 100)

The 1G value is not correct converted! resulting in a wrong upload limit.

Furthermore:
the errors are hard coded into the code, it would make more sense to make these part of the language file. In that way I can make dutch translations for them :)

$errors = array(
0 => "The file is to big. Upload a image under $upload_limit",
1 => 'This file extension is not allowed !',
2 => "Error."
);

Hope this helps :)
regards,
Ruud.
Accepted Answer
admin Accepted Answer
Admin
wow you have right!!
we will fix these issue in next release.

The 1G value is not correct converted! resulting in a wrong upload limit.
this would be very rare :D but we will fix, anyway in future we want to add parameter to set max upload size for each image(and avatar) and file type field
  1. more than a month ago
  2. General
  3. # Permalink
ruud Accepted Answer
Content Protected
  1. more than a month ago
  2. General
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.