Flow.js 以单个块上传
Flow.js uploading in a SINGLE chunk
我正在使用 ng-flow (an angular wrapper for flow.js ) 将图像上传到服务器。
JS 代码:带有以下选项的标准以避免块测试:
{ testChunks:false }
我不想在服务器上实现多块上传的方法,而是简单地接受下面的完整文件上传(即没有块)。
对于那些感兴趣的人,我的服务器 spring-mvc 方法被配置为 return 我在客户端解析的媒体 json 对象:
@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); }
如何让 flow.js 以单个块上传?
我最终将 chunkSize 设置为一个非常大的数字(例如 10MB),这样文件将以一个块的形式发送。当然,如果文件大于该文件,问题仍然存在。
例如
{ chunkSize : 10000000}
我正在使用 ng-flow (an angular wrapper for flow.js ) 将图像上传到服务器。
JS 代码:带有以下选项的标准以避免块测试:
{ testChunks:false }
我不想在服务器上实现多块上传的方法,而是简单地接受下面的完整文件上传(即没有块)。
对于那些感兴趣的人,我的服务器 spring-mvc 方法被配置为 return 我在客户端解析的媒体 json 对象:
@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); }
如何让 flow.js 以单个块上传?
我最终将 chunkSize 设置为一个非常大的数字(例如 10MB),这样文件将以一个块的形式发送。当然,如果文件大于该文件,问题仍然存在。
例如
{ chunkSize : 10000000}