Upload on click dropzone

2 posts, 0 answers
  1. Emanuele
    Emanuele avatar
    1 posts
    Member since:
    May 2012

    Posted 04 Apr 2018 Link to this post

    Hi,
    I wonder if there is any way to include in a dropzone container a functionality of uploading a file
    by clicking on it? In other words keep two functionalities in one place.

    I'll leave here the dojo sandbox for reference  https://dojo.telerik.com/iFEriwoK

    Best regards,

    Emanuele

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2105 posts

    Posted 05 Apr 2018 Link to this post

    Hi Emanuele,

    You can attach a click handler to the span element in the dropzone:
    <span style="color: red;" onclick="onClick()">or click here</span>

    And in the handler trigger the click event of the Upload's input element:
    function onClick() {
      $("#files").click();
    }

    This way clicking on the span will bring up the Upload's file selection dialog. Updated dojo example.

    Regards,
    Ivan Danchev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top