本文介绍了如何使用AJAX的AjaxFileUpload控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在
但是当我实现它时,文件没有上传。此外,未选择多个文件。我该怎么办?
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?
推荐答案
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控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!