File Uploader

Hi Webix Team,

I am trying to fetch the whole file data on file upload event in order to send tit to backedn. But in this file object I do not get any file content related data.
I am getting the response as:

{"file":{},"name":"backupnew.txt","id":1515747182187,"size":1374,"sizetext":"1.34 Kb","type":"txt","status":"client"}

https://webix.com/snippet/fbd9ba39

Is there any other way to fetch the whole file content?

Comments

  • I am trying to fetch the whole file data on file upload even

    You can access raw object through onBeforeFileAdd event, here you have access to the native file object and can create a FileReander object to fetch the content ( https://developer.mozilla.org/en-US/docs/Web/API/FileReader )

    The onFileUpload event does fire when the file is already sent to a server side, here you still can access the file object ( as file.file ) and use FileReader against it.

    file object I do not get any file content related data.

    Just to be clear - file object doesn't provide direct access to the raw data, you need to use FileReader anyway

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion