file-upload

angular 4- How do I send file in POST to backend

感情迁移 提交于 2020-08-27 22:26:35
问题 I have a file upload in the form. I need to create post request to backend with this uploaded file and some other form fields too. Below is my code: fileChange(event) { const fileList: FileList = event.target.files; if (fileList.length > 0) { this.file = fileList[0]; this.form.get('file_upload').setValue(this.file); } } onClick(){ const val = this.form.value; const testData = { 'file_upload': this.file, 'id': val.id, 'name' : val.name, 'code': val.code, }; this.http.post('https://url',

angular 4- How do I send file in POST to backend

戏子无情 提交于 2020-08-27 22:25:38
问题 I have a file upload in the form. I need to create post request to backend with this uploaded file and some other form fields too. Below is my code: fileChange(event) { const fileList: FileList = event.target.files; if (fileList.length > 0) { this.file = fileList[0]; this.form.get('file_upload').setValue(this.file); } } onClick(){ const val = this.form.value; const testData = { 'file_upload': this.file, 'id': val.id, 'name' : val.name, 'code': val.code, }; this.http.post('https://url',

High memory usage when uploading a multipart file to Amazon S3 via streaming?

此生再无相见时 提交于 2020-08-26 07:29:28
问题 The method below in my Java Spring application directly streams and uploads a file to an Amazon S3 bucket. I have researched that using streams will make the uploading of large files (> 100MB videos for my use case) to be more memory efficient. When testing the method with a 25MB file, the memory usage of my Java Spring application in a Kubernetes cluster setup spiked up by 200MB! I also tried a file that was 200MB and the memory spiked up again to ~2GB. There were no out of memory exceptions