AjaxFileUpload
<ajaxToolkit:AjaxFileUpload id="ajaxUpload1" önUploadComplete="ajaxUpload1_OnUploadComplete" ThrobberID="MyThrobber" MaximumNumberOfFiles="1" AllowedFileTypes="jpg,jpeg,gif,png" runat="server" /> <asp:Image id="MyThrobber" ImageUrl="~/images/ajax-loader.gif" Style="display:None" runat="server" />
protected void ajaxUpload1_OnUploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { // Generate file path string filePath = "~/images/" + e.FileName; // Save upload file to the file system ajaxUpload1.SaveAs(MapPath(filePath)); }
<system.webServer> <handlers> <add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit" /> </handlers> </system.webServer>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)