how to start uploads with a submit button click #279
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
how to start uploads file with a submit button click ?
If you only want to upload one file, you can create your own upload function and attach it to a click event in your submit button.
In your component HTML file:
<button (click)="upload()">Submit></button>In your component TS file:
Hope this helps.
Hi @tylermassey
How can I pass parameters to the file upload() method? Because I want to pass a GUID value when triggering my action method in my API controller
Kind Regards
Hi @simoazzo
I believe there is no functionality at this time to post additional data with the
file.uploadmethod. This is one limitation of this library. I encountered the same issue because in my application. I needed to upload a file and a form at the same time. I worked around the issue by making my file upload immediately when it is added, and then I created a separate form to post my other data.If you are trying to only post the uploaded file and a GUID value, you may be able to work around this issue by naming your file with the GUID value and then retrieving this value from the file name on your server.
Good luck!
You can set form data by overriding this method:
this.fileUploader.onBuildItemForm = (fileItem, form)