Jump to content

[SOLVED] Console Error when uploading larger files


Marcel Stäheli
 Share

Recommended Posts

Hello

I had to increase the php-upload file size limit from the standard 2mb to 50mb to upload some pdfs (it's set to unlimited in PW). I edited the php.ini file accordingly. I can now upload files to a size of about 27mb but anything bigger doesn't work. The upload bar takes about 3 seconds to reach 100% and then stays there in Chrome, in Firefox it doesn't move at all. Both browsers throw a console error:

Firefox:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dataJqueryCore.js:2:13589
    parseJSON jQuery
    q 	https://www.globalsystem.ch/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js?v=125-1545384648:1
Chrome:
Uncaught SyntaxError: Unexpected token D in JSON at position 0
    at JSON.parse (<anonymous>)
    at Function.parseJSON (JqueryCore.js?v=1545384648:2)
    at XMLHttpRequest.<anonymous> (InputfieldFile.min.js?v=125-1545384648:1)

It happens with other files too, I tested it with a couple .mp4-files.

Since the uploads up to 27mb take about 2-3 seconds, i don't think it's a timeout problem. But just to be sure I massively increased some values in the php.ini:

upload_max_filesize       600M
post_max_size             700M
max_input_time            90
memory_limit              800M

Still the same errors with anything bigger than 27mb . Has anybody had these console errors before, when uploading files?

I'm running PW 3.0.123 on IIS10

Link to comment
Share on other sites

Thank you for your reply. I looked through these posts, but nothing helped so far. There are no errors in the PW-Logs. I run PHP 7.2.7 so there is no "always_populate_raw_post_data" Option to look for.

It seems like an error on the client side. It happens in every browser.

I had a look at the network tab, and it seems the request itself is corrupt already, it has a length of 73 compared to 741 with a successful upload (see screenshot).

processwire-error.thumb.png.e77942fea6911f60ae84c0e01a2b6b8e.png

The response with the error upload is: The page was not displayed, because the request unit is too big. (Die Seite wurde nicht angezeigt, da die Anforderungseinheit zu groß ist.)

 

Link to comment
Share on other sites

That was it. The default max upload size of IIS10 is 28.3MB as stated here: https://stackoverflow.com/a/40085473

I followed the instructions on stackoverflow and manually edited the web.config-file and now the upload works.

I also found instructions on how to change it using the IIS manager: https://www.inflectra.com/Support/KnowledgeBase/KB306.aspx  (I haven't tried this method myself though)

Thanks, I didn't know about those settings before.

Link to comment
Share on other sites

  • 2 years later...

I ran into the same errors as Marcel, but on CentOS7 with Plesk, hitting a wall at 128MB despite some very generous PHP settings. I was able to resolve the problem by making the following configuration changes within Plesk:

Apache & nginx Settings > Maximum allowed HTTP request body size: 256MB

ModSecurity > Custom Directives: Added "SecRequestBodyLimit 268435456" (without the quotes)

My uploading test worked as soon as I restarted Apache.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...