Upload Content

  

Why Upload content not working when the submit is ajax submit. Actually i want to upload an image and my upload button is ajax submit . And i dont want to reload the whole page when my upload action run. I used ajax But it always show binary data 0. 

Hi Lovish.

The upload widget only works with SUBMIT. This has to do with the way it works.
As a workaround, you can use one of the other options available in the Forge (there are some). 

Cheers,
Eduardo Jauch

Hello Lovish,


From my explanation on another topic (https://www.outsystems.com/forums/discussion/32587/error-empty-0-bytes-excel-received/)

"...what makes the difference between this behavior is the "content-type" used in an ajax or a submit.

If you inspect the requests, you can see that the ajax will use:

text/html; charset=utf-8


Using the "Submit" option you will have the following content type:

Mime type - multipart/mixed 

In the end, this means that you can have different types of data inside the content of this request. Inside of the body, this contents are separated between types. The binary file will be one of them.


Hope this could help you find the reason behind this :)

Kind regards"


Very nice explanation, Miguel. :)

Just to add, using AJAX (generic one) to upload files is possible. For example, this component (if I am not mistaken) uses ajax to asynchronously send multiple files to server.

https://www.outsystems.com/forge/component/352/file-upload/

Cheers,

Eduardo Jauch