Tuesday, July 17, 2012

Upload a file in a single click using jQuery as in gmail attachement

In older days, user wants to browse the button, choose the file and click the upload button for attaching the file.

Nowadays user does not like more mouse click operation. They all are would like to perform all operations within a single click.

The following jquery script is used to upload a file in single click.


<a id='uploader' href='javascript:void(0)'>Add Attachment</a>

   upclick(
     {
      element: uploader,
      action: '/file/fileUpload.action?method=fileUpload,
      dataname:'upload',
      oncomplete:
        function(response_data)
        {
            alert('Data has been sent successfully');
        }
     });
 }


* note: Have to include the attached js file

No comments:

Post a Comment