如何在 ASP.NET MVC 中使用 plupload 包?
我正在使用 plupload 版本 1.3.0
更具体地说,我必须定义控制器操作以支持分块?我可以使用 HttpPosteFileBase
作为参数吗?
目前我正在使用以下代码来初始化插件
在HEAD标签中
<link type="text/css" rel="Stylesheet" media="screen" href="<%: Url.Content( "~/_assets/css/plupload/jquery.ui.plupload.css" )%>" />
<link type="text/css" rel="Stylesheet" media="screen" href="<%: Url.Content( "~/_assets/css/plupload/gsl.plupload.css" )%>" />
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/plupload/gears_init.js" )%>"></script>
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/plupload/plupload.full.min.js" )%>"></script>
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/plupload/jquery.ui.plupload.min.js" )%>"></script>
文档准备就绪
$("#uploader").pluploadQueue({
runtimes: 'html5,html4,gears,flash,silverlight',
url: '<%: Url.Content( "~/Document/Upload" ) %>',
max_file_size: '5mb',
chunk_size: '1mb',
unique_names: true,
filters: [
{ title: "Documenti e Immagini", extensions: "doc,docx,xls,xlsx,pdf,jpg,png" }
],
multiple_queues: false
});
I am using plupload version 1.3.0
More specifically how I have to define my controller action to support chunking? Can I use the HttpPosteFileBase
as a parameter?
At the moment I am using the following code to initialize the plugin
In the HEAD tag
<link type="text/css" rel="Stylesheet" media="screen" href="<%: Url.Content( "~/_assets/css/plupload/jquery.ui.plupload.css" )%>" />
<link type="text/css" rel="Stylesheet" media="screen" href="<%: Url.Content( "~/_assets/css/plupload/gsl.plupload.css" )%>" />
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/plupload/gears_init.js" )%>"></script>
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/plupload/plupload.full.min.js" )%>"></script>
<script type="text/javascript" src="<%: Url.Content( "~/_assets/js/plupload/jquery.ui.plupload.min.js" )%>"></script>
On document ready
$("#uploader").pluploadQueue({
runtimes: 'html5,html4,gears,flash,silverlight',
url: '<%: Url.Content( "~/Document/Upload" ) %>',
max_file_size: '5mb',
chunk_size: '1mb',
unique_names: true,
filters: [
{ title: "Documenti e Immagini", extensions: "doc,docx,xls,xlsx,pdf,jpg,png" }
],
multiple_queues: false
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
开始吧:
对于每个块和正在上传的每个文件,都会多次调用此方法。它将作为参数传递块大小和文件名。我不确定是否可以使用 HttpPostedFileBase 作为操作参数,因为名称不确定。
Here you go:
This method will be called multiple times for each chunk and for each file being uploaded. It will pass as parameter the chunk size and the filename. I am not sure as to whether you could use a
HttpPostedFileBase
as action parameter because the name is not deterministic.看这里:
在控制器中:
仅此而已...控制器中不需要块...
Look here:
And in Controller:
That's all...No chunk is needed in Controller...