Greetings!!
I am trying to count total numbers of files have been selected or dropped in file dropbox in AjaxFileUpload controller. It shows on number of files in Queue. I need to access the numbers of files in queue. How could I do that. I am trying to write onchange event for AjaxFileUpload but it's not working which works for ASP File Uploder.
我试图计算AjaxFileUpload控制器中文件保管箱中已选择或删除的文件总数。它显示了队列中的文件数。我需要访问队列中的文件数量。我怎么能这样做我正在尝试为AjaxFileUpload编写onchange事件,但它不适用于ASP File Uploder。
It will be helpful if I get the number of files have been selected on AjaxFileUpload change.
如果我在AjaxFileUpload更改时选择了文件数,将会很有帮助。
Thanks
3 个解决方案
#1
3
You can count
number of file uploaded successfully from JavaScript
by using OnClientUploadComplete
event. Please check below:
您可以使用OnClientUploadComplete事件计算从JavaScript成功上载的文件数。请检查以下内容:
AjaxFileUpload Code:
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" OnClientUploadComplete="uploadcomplete" OnUploadComplete="AjaxFileUpload1_UploadComplete" Mode="Auto" runat="server" />
JavaScript Ccode:
<script type="text/javascript">
var totalUploaded = 0;
function uploadcomplete()
{
totalUploaded += 1;
}
</script>
For more details about this, please check AJAX Control Toolkit Tutorial: AjaxFileUpload.
有关详细信息,请查看AJAX Control Toolkit教程:AjaxFileUpload。
#2
1
As for my understanding: AjaxFileUpload.js library doesn't support multiple uploads by itself. So you have to implement the multi-file upload by yourself. There are others libraries that support multiple files upload out of the box: Fine Uploader 5 seen to be a nice one.
至于我的理解:AjaxFileUpload.js库本身不支持多个上传。所以你必须自己实现多文件上传。还有其他库支持多个文件上传开箱即用:Fine Uploader 5看起来很不错。
If you need to use AjaxFileUpload you can follow this * question that is related of what you want to do upload multiple files with ajaxFileUpload with different file ids . Then you can add a counter for as many times as you call the function.
如果您需要使用AjaxFileUpload,您可以遵循此堆栈溢出问题,该问题与您要使用不同文件ID的ajaxFileUpload上传多个文件相关。然后,您可以在调用函数时添加一个计数器。
#3
1
you can use "UploadComplete" event to do this
您可以使用“UploadComplete”事件来执行此操作
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
HttpFileCollection uploads = HttpContext.Current.Request.Files;
int NoOfFiles = uploads.Count
}
#1
3
You can count
number of file uploaded successfully from JavaScript
by using OnClientUploadComplete
event. Please check below:
您可以使用OnClientUploadComplete事件计算从JavaScript成功上载的文件数。请检查以下内容:
AjaxFileUpload Code:
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" OnClientUploadComplete="uploadcomplete" OnUploadComplete="AjaxFileUpload1_UploadComplete" Mode="Auto" runat="server" />
JavaScript Ccode:
<script type="text/javascript">
var totalUploaded = 0;
function uploadcomplete()
{
totalUploaded += 1;
}
</script>
For more details about this, please check AJAX Control Toolkit Tutorial: AjaxFileUpload.
有关详细信息,请查看AJAX Control Toolkit教程:AjaxFileUpload。
#2
1
As for my understanding: AjaxFileUpload.js library doesn't support multiple uploads by itself. So you have to implement the multi-file upload by yourself. There are others libraries that support multiple files upload out of the box: Fine Uploader 5 seen to be a nice one.
至于我的理解:AjaxFileUpload.js库本身不支持多个上传。所以你必须自己实现多文件上传。还有其他库支持多个文件上传开箱即用:Fine Uploader 5看起来很不错。
If you need to use AjaxFileUpload you can follow this * question that is related of what you want to do upload multiple files with ajaxFileUpload with different file ids . Then you can add a counter for as many times as you call the function.
如果您需要使用AjaxFileUpload,您可以遵循此堆栈溢出问题,该问题与您要使用不同文件ID的ajaxFileUpload上传多个文件相关。然后,您可以在调用函数时添加一个计数器。
#3
1
you can use "UploadComplete" event to do this
您可以使用“UploadComplete”事件来执行此操作
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
HttpFileCollection uploads = HttpContext.Current.Request.Files;
int NoOfFiles = uploads.Count
}