nishantmc/angular-material-fileupload

Invalid boundary in the content type multipart/form-data

Closed this issue · 6 comments

I am getting this error when i try to upload a file. The Content-Type: multipart/form-data is set, but without boundary.

This is caused because of the default value for headers setting the Content-Type manually to multipart/form-data . If the header is manually set the browser stops setting the header by itself with the boundary property.

As a workaround you can just overwrite the default setting like this

`<mat-file-upload-queue #fileUploadQueue
[fileAlias]="'file'"
[httpUrl]="'http://localhost:8089/upload'"
[httpRequestHeaders]="{}">

<mat-file-upload [file]="file" [id]="i" *ngFor="let file of fileUploadQueue.files; let i = index">

`

[httpRequestHeaders]="{}" will unset the default header which will lead to the behavior that the browser will set the Content-type including boundary attribute

Tested with Chrome

agreed. But this update has never been made in master. I am surprised. looks the repo owner does not follow up this repo.

Just pushed 1.0.0 (angular 6), made the default httpheaders for upload and queue as empty. Please check.

Please try 1.0.1.

@theGirlWithTheDragonTattoo Did you get a chance to try this version?

@theGirlWithTheDragonTattoo Closing this issue, Please let me know if you see any other issues.