Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- upload(file) {
- const req = new HttpRequest('POST', this.urlUpload, file, {
- headers: new HttpHeaders({'Content-Type':'multipart/form-data'}),
- reportProgress: true
- });
- return this.http.request(req);
- }
- download() {
- this.downloader.download().subscribe(event => {
- if (event.type === HttpEventType.DownloadProgress) {
- } else if (event instanceof HttpResponse) {
- this.upload(event.body);
- }
- });
- }
- upload(file) {
- this.downloader.upload(file).subscribe( event => {
- if (event.type === HttpEventType.UploadProgress) {
- } else if (event instanceof HttpResponse) {
- console.log('File is completly uploaded!');
- }
- });
- }
- @PostMapping("/uploadFile")
- public UploadFileResponse uploadFile(@RequestParam("file") MultipartFile file) {
- return ...;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement