如何使用AJAX的AjaxFileUpload控件? [英] How do I use the AjaxFileUpload control of AJAX?

查看:104
本文介绍了如何使用AJAX的AjaxFileUpload控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在

http://www.asp。 net / ajaxLibrary / AjaxControlToolkitSampleSite / AjaxFileUpload / AjaxFileUpload.aspx



但是当我实现它时,文件没有上传。此外,未选择多个文件。我该怎么办?

I used the demonstration at
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx

But when I implemented it, the files are not uploading. Also, multiple files are not being selected. What do I do?

推荐答案

请参考:

简单的AJAX文件上传 [ ^ ]

Ajax /文件上传 [ ^ ]
Please refer:
Simple AJAX File Upload[^]
Ajax / File Upload[^]


在页面上设置脚本管理器,并在服务器端使用此方法保存文件!

SaveAs(字符串文件名)

以及上传文件数量的此属性:

MaximumNumberOfFiles =10这意味着您最多可以上传10个文件!

如果你还有问题,请粘贴代码以获得更多帮助!
set a script manager on your page and use this method on server side to save file!
SaveAs(string filename)
and this property for number of files for upload:
MaximumNumberOfFiles="10" this mean you can upload 10 file in max!
if your still you have problem , paste your code for more help!


下载ajaxtoolkit可能会发布(此功能目前已经发布。)



代码背后(VB)



download ajaxtoolkit May release (this feature has been released currently.)

Code Behind (VB)

Imports System.Data
Imports System.IO
Partial Class AjaxTest
    Inherits System.Web.UI.Page

   
    Protected Sub ajaxUpload1_OnUploadComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AjaxFileUploadEventArgs)
        ' Generate file path
        Dim filePath As String = "~/Uploads/" & Convert.ToString(e.FileName)

        ' Save upload file to the file system
        ajaxUpload1.SaveAs(MapPath(filePath))
    End Sub
End Class







Asp.Net:

添加程序集:






Asp.Net:
Add the assembly:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>







Ajax Control将如下:






And Ajax Control will be like:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
       </asp:ToolkitScriptManager>
   <asp:AjaxFileUpload

       id="ajaxUpload1"

       OnUploadComplete="ajaxUpload1_OnUploadComplete"

       ThrobberID="MyThrobber"

       runat="server"  />

       <asp:Image

           id="MyThrobber"

           ImageUrl="~/Images/indicator3.gif"

           Style="display:None"

           runat="server" />







注意:在解决方案中创建一个文件夹资源管理器命名为Images,另一个命名为Uploads。




Note: Create a folder in your solution explorer named Images and another as Uploads.


这篇关于如何使用AJAX的AjaxFileUpload控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆