Web Forms Quick Start
Use this path for a new ASP.NET Web Forms application that wants the current v5 API.
1. Add the assembly
Copy AjaxUploader.dll into your application's bin folder.
You do not need separate .js or .css files. They are embedded in AjaxUploader.dll and served through ajaxupload.axd.
2. Register the control and handler
Use a Web.config shape like this:
<configuration>
<appSettings>
<add key="AjaxUploader.TempDirectory" value="~/App_Data/UploaderTemp" />
<add key="AjaxUploader.MaxFileSize" value="524288000" />
<add key="AjaxUploader.ChunkSize" value="5242880" />
<add key="AjaxUploader.AllowedExtensions" value=".jpg,.jpeg,.png,.gif,.bmp,.pdf,.doc,.docx,.xls,.xlsx,.zip,.rar,.txt,.csv" />
<add key="AjaxUploader.EnableResume" value="true" />
</appSettings>
<system.web>
<pages>
<controls>
<add assembly="AjaxUploader" namespace="AjaxUploader.Controls" tagPrefix="au" />
</controls>
</pages>
</system.web>
<system.webServer>
<handlers>
<add name="AjaxUploader" path="ajaxupload.axd" verb="*"
type="AjaxUploader.AjaxUploaderHandler, AjaxUploader"
preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
3. Add the uploader to a page
<%@ Register Assembly="AjaxUploader" Namespace="AjaxUploader.Controls" TagPrefix="au" %>
<au:AjaxFileUpload ID="Uploader1" runat="server"
ButtonText="Select a File"
AutoUpload="true"
ShowProgress="true" />
4. Handle server-side events on postback
protected void Uploader1_FileUploaded(object sender, AjaxUploader.Events.FileUploadedEventArgs e)
{
var uploadService = new AjaxUploader.Services.UploadService();
var targetPath = Server.MapPath("~/App_Data/Processed/" + e.FileName);
uploadService.CopyFile(e.FileGuid, targetPath);
}
5. Know the default behavior
- Single file upload is the default unless you enable multiple selection.
- Temp files are stored under
~/App_Data/UploaderTempunless you changeAjaxUploader.TempDirectory. - The handler path defaults to
~/ajaxupload.axd. localhost,127.0.0.1, and::1bypass license detection during development.
Next steps
- For upgrade work from 4.x, read Migrating From 4.x.
- For the main v5 API surface, browse AjaxFileUpload.