...
See the new Filestack Workflows 2.0 in action with our sales engineer. Book a Walkthrough
We are aware of the recently disclosed PHP2Shell vulnerabilities (CVE-2026-109618 and CVE-2026-109619) and can confirm Filestack is not impacted by these vulnerabilities.

HTML File Upload, Fully Managed

Add HTML file upload to any form with two lines of JavaScript. Filestack File Picker brings drag and drop, cloud sources, resumable uploads and storage.

Filestack File Picker
Filestack File Picker open on My Device, with a drop zone for files and a source list that includes Link (URL), Take Photo, Google Drive, Dropbox, OneDrive and Box.
index.html
<button id="upload">Upload a file</button>
<script src="https://static.filestackapi.com/filestack-js/4.x.x/filestack.min.js"></script>
<script>
  const picker = filestack.init('YOUR_API_KEY').picker();
  document.getElementById('upload').onclick = () => picker.open();
</script>

HTML File Upload at a Glance

HTML file upload uses an <input type="file"> element inside a form that posts with enctype="multipart/form-data" to a server that stores the file. The browser handles file selection, and the server handles storage, validation and security. Filestack File Picker adds drag and drop, cloud sources, resumable uploads and managed storage to any HTML page with two lines of JavaScript.

Two Ways to Upload a File From an HTML Page

Native HTML form

  1. input type="file" The user picks a file
  2. Your endpoint Receives the POST
  3. Your storage Keeps the file

Filestack File Picker

  1. File Picker Device, camera or cloud
  2. Filestack Uploads and stores it
  3. File URL Saved with your form
Install
One script tag, filestack-js/4.x.x/filestack.min.js, or npm install filestack-js
Works in
Any HTML page, static or server-rendered
Selection
Drag and drop, paste, multiple files and folders
Sources
Local device, camera, URL, Google Drive, Dropbox, OneDrive, Box and more
Storage
Filestack storage, or your own Amazon S3, Google Cloud Storage or Azure container
File size
Limits depend on plan. See pricing
Getting started
Free plan with an API key. Compare plans
Security
Signed policies, domain allow-lists, and virus detection on paid plans

How HTML File Upload Works

HTML file upload takes three parts: an <input type="file"> to choose files, a form that posts them as multipart/form-data, and a server that stores them. For image upload, add accept="image/*"; for multiple files, add multiple.


  1. <input type="file"> renders the browser's file chooser, the HTML upload button. name is the field your server reads, and accept filters the chooser by type.

    The HTML file input guide covers every attribute in depth.


  2. A file travels in a POST request. enctype="multipart/form-data" tells the browser to send the file's bytes along with the other fields; the default encoding sends the file name alone.


  3. Add multiple to the input type file element for a multiple file upload in HTML. With HTML5 file upload, the selected files arrive as a FileList you can read in JavaScript before the form submits.

The file input
<label for="avatar">Profile picture</label>
<input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg">
Try it
upload-form.html
<form action="/upload" method="post" enctype="multipart/form-data">
  <label for="document">Document</label>
  <input type="file" id="document" name="document" required>
  <button type="submit">Upload</button>
</form>
Try it
multiple.html
<input type="file" id="photos" name="photos" accept="image/*" multiple>
<script>
  document.getElementById('photos').addEventListener('change', (event) => {
    for (const file of event.target.files) {
      console.log(file.name, file.size, file.type);
    }
  });
</script>
Try it

    Attribute Reference

    Attribute What it does Example
    accept Filters the file chooser by MIME type or extension accept="image/*,.pdf"
    multiple Lets the user select more than one file multiple
    capture Opens the device camera on mobile, front or back capture="environment"
    required Blocks form submission until a file is chosen required
    webkitdirectory Selects a whole folder and its files webkitdirectory

    Accessible HTML File Upload

    An accessible HTML file upload starts from the native input, which keyboards and screen readers already reach, and adds four details. The HTML file upload accessibility guide covers the full WCAG checklist.

    • A visible label

      Tie a to every file input, and name the accepted types and size in it.

    • A visible focus ring

      Keep the keyboard focus outline on the input or on its custom button.

    • Announced status

      Write errors and upload progress into an aria-live region so screen readers hear them.

    • A custom button that stays reachable

      Visually hide the native input with a clip pattern, so keyboards and assistive technology still reach it.

    Accessible input
    <label for="resume">Resume (PDF, up to 5 MB)</label>
    <input type="file" id="resume" name="resume" accept=".pdf"
           aria-describedby="resume-status">
    <p id="resume-status" aria-live="polite"></p>
    Try it

    What HTML File Upload Needs in Production

    A production HTML file upload needs a server to store files, resume for large files, cloud imports, an accessible button, and protection against file upload vulnerabilities: type checks by content, size limits, malware scanning and signed access.

    Build It on Your Server

    6 parts your team builds and runs
    01 An upload endpoint and file storage
    02 Chunked uploads that resume after a dropped connection
    03 Imports from Google Drive, Dropbox, the camera and a URL
    04 Type checks by content, size limits and malware scanning
    05 Signed access to every upload
    06 An upload button that is styled and accessible

    Add Filestack File Picker

    1 script tag for all six, with storage hosted
    index.html
    <script src="https://static.filestackapi.com/filestack-js/4.x.x/filestack.min.js"></script>
    <script>
      filestack.init('YOUR_API_KEY').picker().open();
    </script>

    Signed uploads use one small signing endpoint. Virus detection and adaptive resume run on paid plans.

    Add Filestack File Picker to Your HTML Form in Two Lines

    To add a file upload to an HTML form with hosted storage, load filestack-js, open File Picker from a button, and save the returned URL in a hidden field. The same picker connects Google Drive, Dropbox and other cloud sources through fromSources.


    1. Load filestack-js from the Filestack CDN. The 4.x.x path always serves the latest version 4 release.


    2. Initialize the client with your API key and open the picker on click. accept, maxFiles, maxSize, fromSources and storeTo set what users can upload and where it lands.


    3. Write the returned URL into a hidden field. The form posts as before, and your server stores a URL instead of receiving the bytes.

      Signed uploads add one small endpoint that signs a policy, or a domain allow-list limits uploads to your site.

      Try the form in the live demo
    Script tag
    <script src="https://static.filestackapi.com/filestack-js/4.x.x/filestack.min.js"></script>
    index.html
    <button type="button" id="pick">Upload your picture</button>
    <script>
      const client = filestack.init('YOUR_API_KEY');
      const picker = client.picker({
        accept: 'image/*',
        maxFiles: 1,
        maxSize: 10 * 1024 * 1024,
        fromSources: ['local_file_system', 'webcam', 'googledrive', 'dropbox'],
        onUploadDone: saveUrl,
      });
      document.getElementById('pick').addEventListener('click', () => picker.open());
    </script>
    Hidden field
    <form action="/profile" method="post">
      <input type="text" name="name" placeholder="Full name">
      <input type="hidden" name="avatar_url" id="avatar_url">
      <button type="submit">Save</button>
    </form>
    <script>
      function saveUrl(result) {
        document.getElementById('avatar_url').value = result.filesUploaded[0].url;
      }
    </script>

    Features Developers Get on Top of HTML

    For drag and drop file upload in HTML, Filestack File Picker lets users drop or paste images, pick files from cloud drives, and crop before upload, all from one script tag.

    Drag and drop and paste

    Drop files onto the picker, or paste a screenshot straight from the clipboard.

    Multi-file and folder upload

    Set maxFiles for several files at once, and select whole folders in File Picker 4.0.

    Cloud sources and camera

    Import from Google Drive, Dropbox, OneDrive, Box, a URL or the device camera.

    In-browser image editing

    Crop, rotate and circle-crop images before they upload.

    Resumable uploads

    Large files upload in chunks and resume. Adaptive Intelligent Ingestion runs on paid plans.

    Security

    Signed policies and domain allow-lists control uploads. Virus detection runs on paid plans.

    Native HTML Input vs Filestack File Picker

    A good file upload experience shows progress, previews images, accepts drag and drop and cloud files, and recovers from dropped connections. Here is how the native input and File Picker compare. Read the full comparison.

    Native HTML file input Filestack File Picker
    Server-side code An upload endpoint, storage and validation you build and run Hosted upload and storage, plus one signing endpoint for signed uploads
    Resumable uploads One request per submit; a retry resends the whole file Chunked multipart uploads that resume
    Max file size Set by your server configuration Set by your plan
    Cloud sources Local files, plus the camera on mobile with capture Google Drive, Dropbox, OneDrive, Box, URL, camera and more
    Image editing A separate library or custom canvas code Crop, rotate and circle before upload
    Virus scanning Your own scanning service Virus detection in Workflows, on paid plans
    Accessibility and styling Browser-default button, restyled with a label and CSS Prebuilt picker interface, styled through the CSS reference
    Time to production Depends on the backend you build Most teams ship their first upload in under a day

    Native HTML is free and suits small internal forms backed by a server you already run.

    What Happens After Upload

    To generate image thumbnails automatically after upload, add a resize task to the file’s CDN URL. Every Filestack upload returns a handle and a URL that takes processing tasks.

    Every upload returns a handle and a URL

    handle
    AFrHW1QRsWxmu5ZLU2qg
    url
    https://cdn.filestackcontent.com/AFrHW1QRsWxmu5ZLU2qg

    Sample values from one upload.

    1. Thumbnails from the URL

      A resize task in the CDN URL returns a 200 by 200 crop.

      https://cdn.filestackcontent.com/resize=width:200,height:200,fit:crop/HANDLE
    2. Convert and compress

      Add output=format:webp or compress to the same URL. Image transformations

    3. Workflows on upload

      Run virus scanning, OCR and tagging with Workflows as each file arrives, on paid plans.

    4. A webhook when done

      Your server receives a signed webhook when processing finishes, on paid plans.

    Give your HTML form drag and drop, cloud sources and resumable uploads today.

    • Most teams ship their first upload in under a day
    • Trusted by 100,000+ applications
    • SOC 2 compliant

    HTML File Upload FAQs

    How do I add a file upload to a webpage in HTML?

    Add <input type="file" name="file"> inside a form with method="post" and enctype="multipart/form-data", and point the form at a server endpoint that stores the file. For hosted storage, add Filestack File Picker with one script tag.

    How do I make an HTML form send the file contents?

    Set enctype="multipart/form-data" and method="post" on the form. That encoding sends the file’s bytes with the other fields. The default encoding sends the file name alone.

    How do I allow multiple file uploads in HTML?

    Add the multiple attribute to the file input. The browser then lets users select several files, and JavaScript reads them from the input’s files list. With File Picker, set maxFiles.

    How do I style the "Choose File" button?

    Style a <label> tied to the input as your button, and visually hide the input with a clip pattern so keyboards and screen readers still reach it. File Picker ships its own styled interface.

    Is there a file size limit for HTML file uploads?

    HTML leaves file size open. The limit comes from your server configuration, or from your Filestack plan when File Picker handles the upload. See plan limits.

    How can a static site accept file uploads?

    Use a hosted uploader such as Filestack File Picker. Files go from the browser to Filestack storage, and a domain allow-list limits uploads to your site. Signed uploads use one small signing endpoint.