Search Results for

# 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 targetFolder = Server.MapPath("~/App_Data/Processed");
        System.IO.Directory.CreateDirectory(targetFolder);
        var safeFileName = System.IO.Path.GetFileName(e.FileName ?? string.Empty);
        if (string.IsNullOrEmpty(safeFileName)) return;
        var targetPath = System.IO.Path.Combine(targetFolder, safeFileName);
        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/UploaderTemp` unless you change `AjaxUploader.TempDirectory`.
- The handler path defaults to `~/ajaxupload.axd`.
- `localhost`, `127.0.0.1`, and `::1` bypass 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.