Issue #998Opened April 3, 2018by tonygiang0 reactions

[BUG] Asset Manager sends empty request when uploading image

Question

Description: GrapesJS editor is initialized in an editor.html file as follows:

  var editor = grapesjs.init({
    container: '#gjs',
    height: '100%',
    fromElement: true,
    plugins: ['gjs-preset-newsletter'],
    assetManager: {
      autoAdd: 1,
      upload: 'http://localhost:9001/uploadimage.php',
      uploadName: 'upload',
    },
  });

localhost:9001 is a local IIS server running PHP5. The content of uploadimage.php is as follows:

<?php
$logfile = fopen("testlog.txt", "a+");
$req_dump = print_r($_FILES, TRUE);
fwrite($logfile, $req_dump . PHP_EOL);
fclose($logfile);

Since images uploaded from GrapesJS is expected to be in the $_FILES array, I dump all of its content to a log file everytime a request reaches this page. The testlog.txt file always gets

Array
(
)

each time I upload an image from the Image element found in gjs-preset-newsletter plugin, indicating that Asset Manager is sending empty requests to the server. File upload is enabled in my php.ini:

file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20

And the test image file is way below PHP's limit. To be exact, I used GitHub_Logo.png found in a package here for testing. Am I doing something wrong?

OS: Windows 10 GrapesJS version: v0.14.6 Browser: Chrome 65

Answers (3)

artfApril 5, 20180 reactions

What about the client-side? Do you see the upload request correctly (eg. from the inspector)?

no-response[bot]April 25, 20180 reactions

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

lock[bot]September 17, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.