Paste Upload

Demo uploads land in a temporary store and are swept after 60 minutes. To keep files, handle FileUploaded — see Single File for the complete save pattern.
Paste Upload

Enable clipboard paste upload with EnablePaste="true". Users can paste images from the clipboard (Ctrl+V / Cmd+V) directly into the upload area. Ideal for screenshots, copied images, and quick image sharing workflows.

What you should see: copy an image and paste it onto the page (Ctrl+V) - it joins the queue like a picked file. Browse works too; images only.
Drag & drop files here, or paste from clipboard
Try it: Copy an image to your clipboard (e.g., take a screenshot with Print Screen), then click in this area and press Ctrl+V to paste and upload it.
<%-- Server control with paste enabled --%>
<au:AjaxFileUpload ID="Uploader1" runat="server"
 EnablePaste="true"
 AutoUpload="true"
 ShowProgress="true"
 AllowedExtensions="jpg,jpeg,png,gif,webp,bmp"
 ButtonText="Browse or Paste (Ctrl+V)" />

<%-- JavaScript API equivalent --%>
AjaxUploader.create(el, {
 uploadUrl: '/ajaxupload.axd/upload',
 paste: true,
 autoUpload: true,
 allowedExtensions: ['jpg','jpeg','png','gif','webp','bmp'],
 onTaskComplete: function (file) {
 statusEl.textContent = 'Pasted/uploaded: ' + file.name;
 }
});

Paste is on by default

The property above is explicit for clarity, but you do not need it: Paste defaults to true, so an uploader accepts Ctrl+V as soon as you drop it on the page. Set Paste="false" to turn it off. EnablePaste is a compatibility alias for the same property.

What actually arrives when a user pastes

Two different things land on the clipboard and both are handled:

  • A screenshot (Print Screen, Win+Shift+S, Cmd+Shift+4) arrives as raw image data with no filename. The uploader names it for you and uploads it like any other file.
  • A copied file from Explorer or the Finder arrives with its real name and type intact.

Restrict what is accepted with AllowedExtensions, exactly as this demo does - a paste that fails the rule is rejected in the browser, before anything is transferred.

Screenshots get named for you

A screenshot has no filename — the clipboard hands over raw image data. Rather than posting an empty name, the uploader generates one from the timestamp and the image type, so a paste at 14:30:52 on 23 August 2026 arrives as Screenshot_20260823_143052.png. A image/jpeg paste becomes .jpg, not .jpeg. Copied files keep the name they already had.

Where the user has to paste

Paste is bound to the uploader element by default, and the element is given tabindex="0" if it does not already have one — an element cannot receive a paste event unless it can take focus. That is why the instruction above says to click the area first.

To accept a paste anywhere on the page, point pasteTarget at a wider element. It takes a CSS selector or an element:

AjaxUploader.create(el, {
  uploadUrl: '/ajaxupload.axd/upload',
  pasteTarget: 'body'   // or any selector / element
});

Inspecting or blocking a paste

The onPaste callback runs with the files the clipboard produced, before anything is queued. Return false to discard the paste entirely — useful when you want to accept typed text normally but reject pasted files in a particular context:

onPaste: function (files, uploader) {
    if (files.length > 3) { alert('Paste up to three images at a time.'); return false; }
}

There is a matching paste event if you prefer uploader.on('paste', ...).

Why teams use it

Paste removes the save-then-browse-then-find detour from the workflows where screenshots matter most: bug reports and support tickets, chat-style attachments, and CMS or documentation editors where an author is already copying images. It pairs naturally with drag and drop - together they cover almost every way a user has an image in hand.

Related

  • Image upload - resize, crop and validate before the transfer.
  • Drag and drop - drop zones, full-page drops and folder drops.
  • Learn - how uploads work in Web Forms.