How to use fw-file-uploader

It is not clear how to use this component from the documentation:

  1. When are the events triggered? Is there an event which is triggered when a file has been selected?
  2. How do you access the uploaded files on the server?
  3. Is it possible to access files on the client side? I cannot see any properties associated with the DOM object.

Background:
I have a user-defined json file that is part of the configuration information for an app I am updating. I am migrating the configuration HTML script to use crayons to provide a consistent look’n’feel with other Freshdesk apps. In my previous version, I used the standard HTML INPUT type File box to specify the file to be uploaded, and accessed the FileList object to access individual files, and then used the HTML5 FileReader object to read the json file

1 Like

Really sad to see there’s no answer to this. I thought I was the only one not really getting how to use this component, but now I see it was not just my imagination :frowning: Documentation seems pretty incomplete to me also and I have a very similar problem.

Also, sorry if this notification made you think someone finally answered with a solution, haha :frowning:

Alejandro

I do have a work around in that I can use a standard HTML file input object and which permits access to the selected files, but this only works as I need access to the file contents within the client javascript environment.

Dave

@Shravan_K can you please assist here?

Hi Dave and Alejandro, the file uploader component does trigger an event ‘fwStageChanged’ when files are selected. However, this event does not contain information regarding the selected files. As you mentioned in your comment, there is also no property to access locally selected files.

Currently, only on providing the ‘actionURL’ prop and uploading the files to the server, ‘fwFilesUploaded’ event is emitted with the response provided from the server.

I agree that it makes sense to include the property to get locally selected files in the component. We will prioritise this, work on it and get back to you on further updates in this thread. We will work on improving the documentation too as part of this request. Thanks for the feedback.

1 Like

Thanks for the prompt response.

Does the ‘‘fwStageChanged’ event apply to any other component?

No, this is specific to file uploader component.