Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Image not uploading within posts
odannyc
New
When I try and upload an image via the text editor, whether I'm creating new discussions or adding comments I get this error: "(image.jpg) is too large (max false bytes)."
Any help is greatly appreciated. Thanks.
Tagged:
0
Comments
Have you tried a variety of pictures? Where is the error originating from (Chrome developer tools, Vanilla debug log, etc)?
Have you set enough size in config.php?
$Configuration['Garden']['Upload']['MaxFileSize'] = '64M';
And also check with host what is the maximum. Most hosts allow 64MB max....
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Also : see this config
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Hey thanks for the replies. I've tried with all kinds of images, small, big, all types of extensions to no avail.
One thing I did notice is that using the ImageUpload plugin everything works fine, but not the native picture upload in the advanced editor.
@odannyc could you post a screenshot of the error (and backtrace if available)?
you said: I get this error: "(image.jpg) is too large (max false bytes)."
see the Tutorials in the category Tutorials! look at the Code!
I read the tutorials, and looked through the code.
looking at the editor plugin php code you will see
three variables affect upload ability.
the two ini get statements are pulling info from your php settings.
to determine your php settings - use phpinfo and look for upload_max_filesize and 'post_max_size
lucky you are - there are tutorials on how to use phpinfo. where? in the tutorials category.
the
c('Garden.Upload.MaxFileSize', '1MB') says if you have a config statment relating to Garden Upload MaxFileSize
it will use that number otherwise it will default to 1MB.
next $MaxSize = min($PostMaxSize, $FileMaxSize, $ConfigMaxSize);
the minimum size of the upload_max_filesize and 'post_max_size and Garden Upload MaxFileSize is selected.
you could add a decho or echo or var_dump after this line. to determine the value of $MaxSize.
next $c->addDefinition('maxUploadSize', $MaxSize) adds the definition so the js can use the values.
next look at Garden.Upload.AllowedFileExtensions if the extensions are not allowed you can't upload extensions.
now lets look at the js.
var maxUploadSize = gdn.definition('maxUploadSize');
you could console.log the value in console for maxUploadSize.
once again Tutorials available of for use console - firebug, Chrome, etc.
here is the error mesage you received:in the editor.js
message += 'is too large (max ' + maxUploadSize + ' bytes)';
you stated. I get this error: "(image.jpg) is too large (max false bytes)."
max false bytes
if looks like maxUploadSize is false. in your case? Why?
how do we debug this?
by the standard troubleshooting protocol. see the Tutorial category for a discussion on this.
check your config statements. test with default theme. disable other plugins. enable editor plugin.
WSIWYG has some peculiarities. test with a different input format. see Tutorials for input format.
how can you see the values that available for js added definitions. one way is to use the console.
in chrome type f12 . click console. then type in gdn.meta. you will see a list of items in the object.
use the arrows. and you will see for vanilla forums all of the meta variables
including this one.
maxUploadSize: 52428800
you could also use alert and console logging of the object source but this is the easiest.
troubleshooting steps. does upload work with default theme and all plugins but the advanced editor plugin disabled.
provide your configuration statements regarding file size and uploads and extensions and what extensions and exact sizes you tried. provide any attempts at code debugging via echo, etc. screenshot of gdn.meta with console.
do you see any js errors in console?
my guess you have a js error without further input from you.
with your testing and answers, it should be easy to determine the issue.
is the problem across all types of browsers or browser specific? Do all users have same problem?
what are the values?
does the file Already Exist? then we would expect this message += 'is already in this discussion. It will not be uploaded again';
validSize is set to TRUE or FALSE here...
why is validSize False?
but why is MaxUploadSize false - js error??? if MaxUploadSize had a value - we would expect the size in bytes to be given.
I didn't get anywhere trying to troubleshoot.
On thing I do need to mention is the exact same code works in my development environment... when I upload a picture through advanced editor there, the picture uploads just fine, but when I do it in my production website it gives me the error, "Max False Bytes", it happens in all browsers, and the image size does not matter.
At first I thought maybe I didn't have file uploads enabled in my server but I do. Another thing that throws me off is that I can upload pictures through the FileUpload plugin just fine, but not the advanced editor part.
Again, this works on my development machine (XAMPP) , but not production.
Solved. I was using HHVM for production and the ini_get() had different value names than the ones in HHVM.
I enabled enable_zend_ini_compat in HHVM