Upload: Intercept and change files

2 posts, 0 answers
  1. Thiam Chye
    Thiam Chye avatar
    8 posts
    Member since:
    Sep 2012

    Posted 14 Dec 2012 Link to this post

    Hi there,

    I have a rather weird requirement... currently we are using the upload widget, and is using it to upload zip files. The files can be huge, and a significant portion of the zip content can be discarded and not uploaded.

    Thus I am wondering is there anyway for us to:
    1.) intercept the upload widget just before it performs the upload
    2.) retrieve the user selected files
    3.) run it on a custom script which converts the zip files into the smaller desired file
    4.) uploads these converted files instead

    We are wondering whether is there any API or ways to perform steps 1,2 and 4 using the upload widget? Currently, I listened to upload event, which fulfills steps 1 and 2, but is unsure how we could achieve step 4. Thank you!
  2. Dimo
    Admin
    Dimo avatar
    8478 posts

    Posted 17 Dec 2012 Link to this post

    Hello Thiam,

    The described scenario is impossible to achieve with standard HTML and Javascript, due to the following restrictions:

    2. Some browsers do not provide information about the file size on the client, so client validation is not always possible.
    3. Javascript does not have access to the file system, so it cannot read existing files or save new ones.
    4. Browsers can upload only files, which have been explicitly and manually selected by the user via the popup dialog.

    Greetings,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top