Before asking for help please read "Requesting Help and Suggestions" by clicking on that tab above here.
  • Page:
  • 1

TOPIC:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dat 2 days 23 hours ago #1

  • nilemah
  • nilemah's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
Hello,
I recently installed version 2.1.7. When I want to add a media object, I encounter during saving this error "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data". How to proceed ?
Thanks.
Imer
webtrees 2.1.7 Apache/2.4.41 (Ubuntu) PHP 7.4.3
Localhost Linux Mint 20.2 kernel: 5.4.0-132-generic

Please Log in or Create an account to join the conversation.

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dat 2 days 19 hours ago #2

  • fisharebest
  • fisharebest's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 16475
Several people have had this error. For them, it was caused by "apache mod-security".

This is a "web security" system that blocks requests which match certain rules.

It is well-known for false-positives and blocking legitimate requests.

To verify this, you can use these instructions to view the server response.
webtrees.net/faq/xhr/
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dat 2 days 19 hours ago #3

  • nilemah
  • nilemah's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
Thank you very much for your answer. I followed your advice and the error is:

<div class="alert alert-danger" role="alert" style="white-space: pre-wrap;">Erreur lors de l’envoi de votre fichier sur le serveur.<br>Nom du fichier : FRAD022_7E191_71_024.jpg<br>Le fichier téléversé dépasse la taille autorisée. …/app/Services/MediaFileService.php:203
#0 …/app/Http/RequestHandlers/CreateMediaObjectAction.php(72): Fisharebest\Webtrees\Services\MediaFileService->uploadFile()
#1 …/app/Http/Middleware/RequestHandler.php(54): Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectAction->handle()
#2 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\RequestHandler->process()

...

I modified the php.ini file increasing the size for uploaded files

; Maximum allowed size for uploaded files.
; php.net/upload-max-filesize
upload_max_filesize = 20M; upload_max_filesize = 2M


and the problem is solved now.
Thanks again.
Imer
webtrees 2.1.7 Apache/2.4.41 (Ubuntu) PHP 7.4.3
Localhost Linux Mint 20.2 kernel: 5.4.0-132-generic

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum