Scalar file upload error

When attempting to upload a not-really-too-large-for-the-modern-internet PDF file (about 20MB) Scalar keeps timing out with the Javascript error message:

There was an error saving the file: SyntaxError: Unexpected token < in JSON at position 0

The app’s error_log shows a timeout - Maximum execution time of 300 seconds exceeded in /home/foo/public_html/bar/system/application/libraries/Image_Metadata.php

What I’ve done so far:

PHP INI - upped upload_max_filesize to 512MB and post_max_size to 1024MB just in case this was causing an issue, no joy, but didn’t expect this to be a problem

.htaccess - added php_value max_execution_time 600 - still no joy

There are 2 closed issues in the repo that seem to have been fixed with their releases:

JSON parsing error displayed to user when uploaded file is too large · Issue #24 · anvc/scalar · GitHub and Image_Metadata.php causing JS and AJAX errors on file upload · Issue #126 · anvc/scalar · GitHub

I seem to remember coming across this before but don’t remember what the fix was … also not sure why it’s going to take 5 minutes to upload 20MB? This has happened across multiple logins and locations, it was first brought to my attention by someone else outside our org attempting to use a demo site I was working with them on.

We’re on PHP 7.4

Based on the error coming from the Image_Metadata.php script I’d guess it’s not the file upload itself that’s taking so long, but Scalar processing the file for Metadata extraction. I’d try manually specifying metadata on the upload page and see if that changes anything.

Tried my own suggestion with a 26 MB pdf and I couldn’t get it to work however, hosting that pdf elsewhere on my account and importing it as a linked file in Scalar does seem to work

I logged an issue on the repo: File upload error - Maximum execution time of 300 seconds exceeded in ... /system/application/libraries/Image_Metadata.php · Issue #197 · anvc/scalar · GitHub

the scalar folks found a fix, advised they will be rolling it out to reclaim soon.

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.