checklist checklist - 3 months ago 56
AngularJS Question

Flow.js uploading in a SINGLE chunk

I am using ng-flow (an angular wrapper for flow.js ) to upload images to a server.

JS code: standard with the following option to avoid chunks testing:

{ testChunks:false }


I prefer NOT to implement on the server a method for multi-chunks upload but simply accept the full file upload as below (i.e. no chunks).

For those interested, my server spring-mvc method is configured to return a Media json object which I parse on the client:

@RequestMapping(value="/account/images/upload-file", method=RequestMethod.POST, produces = { "application/json"})
@ResponseBody
public Media uploadFile(
@RequestParam("file") MultipartFile multipartFile,
@RequestParam(name="accountId", required=true) String accountId,
HttpServletRequest request,
HttpServletResponse response) throws IOException { return new Media(multipartFile, accountId); }


How can I get flow.js to upload in a single chunk?

Answer

I ended up setting chunkSize to a very large number (e.g. 10MB) so that the file will be sent in one chunk. Naturally, if the file is larger than that, the issue remains.

E.g.

{ chunkSize : 10000000}