0

I have created two selects and want to send their values as parameters to the backend during upload. Do you know how to do that? Can you help me please?

My Code:

// Select Forms
 // Month form
    this.sendMonthsForm = this.fb.group({
      monthsValue: [null]
    });
    // Year form
    this.sendYearsForm = this.fb.group({
      yearsValue: [null]
    });
// Upload
  this.uploader = new FileUploader({
        url: `${environment.baseUrl}/upload?title=SuSa&context=${year}&period=${month}`,
        maxFileSize: 2 * 1024 * 1024,
        allowedFileType: ['csv', 'xls', 'xlsx'],
        authToken: `Bearer ${currentUser.auth_token}`,
      });
  • Does this answer your question? [How to add Custom Headers in ng2-file-upload](https://stackoverflow.com/questions/42568061/how-to-add-custom-headers-in-ng2-file-upload) – Santhosh V Apr 25 '20 at 18:25
  • Possible duplicate https://stackoverflow.com/questions/42568061/how-to-add-custom-headers-in-ng2-file-upload – Santhosh V Apr 25 '20 at 18:26

2 Answers2

0
uploader: FileUploader = new FileUploader({
  url: URL,
  headers: [{ name: 'Authorization', value: 'Bearer ejy...' }]
});
Santhosh V
  • 380
  • 1
  • 11
0
this.uploader = new FileUploader({
        url: `${environment.baseUrl}/upload?title=SuSa&context=${year}&period=${month}`,
        maxFileSize: 2 * 1024 * 1024,
        additionalParameter:{uploaderparams1:'its-value',uploaderparams2:'its-value'},
        allowedFileType: ['csv', 'xls', 'xlsx'],
        authToken: `Bearer ${currentUser.auth_token}`,
      }); 
David Buck
  • 3,752
  • 35
  • 31
  • 35