Is there any example how to set up form element with type file to upload it via AJAX and without upload button. I want to be same as stackexchange. upload image

1 Answer 1


These modules can help you

HTML5 Drag & Drop File

HTML5 drag & drop + HTML5 file upload with XHR2. Allows the user to drag & drop files into a Image/File Field and uploads it immediately behind the scenes. In theory it should work for as many files as the field allows.

Requires jQuery >= 1.5.2 (jquery_update‎ has that)!

It's a start...

Works for all managed_file fields
You can disable per field in the field instance config

There's a settings form under Config > Media where you can change the upload method from Series to Parallel (much faster, but slightly riskier). If you dare, try it out. I've experienced (although not for a while) the full entity form being submitted by a file upload.

If you're uploading A LOT of files, you might encounter the server's max file/POST size limit. I've no solution for that yet.

Drag'n'Drop Uploads(you can use dev version,I am using it and work;) )

The Drag'n'Drop Uploads module adds the ability to drag an image from your local filesystem, drop it onto a node body textarea and have the file automatically uploaded and referenced in your node.

(maybe you just need some custom jquery coding, first hide upload button then fire upload button programmatically in your js)


Plup module enables uploads to file fields using the popular plupload library. It does not require any other modules to work, but the plupload library must be downloaded separately (version 1.5.8 is the last supported version).

Please note that you must remove the "examples" folder from the downloaded plupload library to avoid introducing a security vulnerability.

The original developer is no longer maintaining the module, and I will only minimally maintain it until Media 2.x has a stable release that works with plupload and multiform, after which I expect to migrate to those modules.

  • Good old plupload integration works, too. Is it missing because you don't know it or because you prefer plup?
    – Mołot
    Commented Aug 7, 2015 at 20:53
  • Nothing for Drupal 8 ... :-(
    – steveoriol
    Commented Nov 1, 2018 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.