I´am using a Angular frontend and PHP backend to try upload files and save them on an ftp-server.
To Upload the Files is this code used:
uploadFiles(file: File, uploadFolder: string): Observable<ApiResponseModel> {
const adress = environment.apiAdress.api + environment.apiAdress.fileUpload;
let header: HttpHeaders = this.getHeader();
header = header.set('Content-Type', 'multipart/form-data');
const formData: FormData = new FormData();
formData.append(uploadFolder, file, file.name);
return this.httpClient.post<ApiResponseModel>(adress, formData, {headers: header });
}
In my PHP backend i get the file Content und a description of the Post(Content-Type, Content-Disposition, etc), but i cant create a file as long as the additional information in the content is available. Is it possible to remove them easily?
The file-content i get looks like this:
"------WebKitFormBoundaryCr85Bf8XFGMEeJy5
Content-Disposition: form-data; name=""; filename="PDF_Test.pdf"
Content-Type: application/pdf
%PDF-1.5 %����
PDF Content
------WebKitFormBoundaryCr85Bf8XFGMEeJy5 "