pourquoi / ckeditor5-simple-upload

32 stars 22 forks source link

What is the signature of REST API Method #10

Closed SKGGitHub closed 6 years ago

SKGGitHub commented 6 years ago

We are trying to integrate it in our react application. Able to integrate it in UI and able to drag and drop image but request is not reaching to REST API end point and ended with error popup (attached error_popup.jpg).

S0 when I try to drag and drop image, request ends up with HTTP 500, internal server error but not reaching my rest api end point. Attached is the Sample Rest API method snippet for ref. I was not sure what would be the data type of upload parameter which will be sent by UI so using Object.

Also attached is the error logged in Network console while trying to drag and drop image.

Please help. error_popup network_console_error ckeditor.txt

Above added UI Ckedtior file and errors screenshots.

Below is the code snippet of rest api end point.

[HttpPost] public HttpResponseMessage ImageUpload([FromBody] Object upload) { var imageUrl = "YOUR-FILESERVER-URL";

        return Request.CreateResponse(HttpStatusCode.OK, new { uploaded = true, url = imageUrl });
    } 
pourquoi commented 6 years ago

Hi the request IS reaching your server

it's a multipart MIME request so i'm not sure [FromBody] works with that.. but i'm not aspnet dev

maybe try this https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/sending-html-form-data-part-2

SKGGitHub commented 6 years ago

Hi Yes, your guidance was helpful and I make it working now.

Thanks for your support! I deeply appreciate the quick and useful response.