extension exclusion and sync upload

4 posts, 1 answers
  1. Alberto
    Alberto avatar
    71 posts
    Member since:
    May 2012

    Posted 05 Aug 2013 Link to this post

    Hi guys,

    I'm working with kendo upload and I need some clarifications.

    After looking around I understood that is not possible to filter file extensions before user imput ( like the old *.pdf). Is it correct?
    If it is, could I use an handler on "select" and manually remove the selected file if it not matches the requested extension? how?

    second question:
    I normally use the upload in async mode, but this time I'd prefer to use it in sync mode.
    The problem is that I'm kind of confused..how could I access the selected file's data??

    I red on your doc that with sync mode the file is uploaded when the form is submitted...
    ok..but where could I find its data? the client-side events are never fired..
    I must say that the documentation is quite poor on this topic!

    Thanks
    Fabio
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2156 posts

    Posted 06 Aug 2013 Link to this post

    Hi Fabio,


    I'll go straight to your questions.
    1. Regarding the first question, yes you should bind to the select event of the upload, manually check the file types in the event handler and cancel the event if needed, which will prevent the file selection.
    2. Regarding the second question, only the select event is fired when the Upload is in synchronous mode. In the event handler you could get information about the uploaded file (on the client side). You could find a complete demo here.


    Regards,
    Dimiter Madjarov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Alberto
    Alberto avatar
    71 posts
    Member since:
    May 2012

    Posted 27 Aug 2013 Link to this post

    Hi Dimiter,
    From the example I can't understand where I can find uploaded object's raw data (bytes, in order to write files on my server's file system) .
    In particular what's TempData?
    note that I'm not using MVC Pattern
    Thanks
    Fabio
  5. Answer
    T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 29 Aug 2013 Link to this post

    Hello,

    The Upload sends the file in a request identical to a regular form submit (multipart/form-data). The code you'd normally use to handle a form POST will also work with the Upload.
    For ASP.NET WebForms that'd be the Request.Files collection.

    The TempData is a feature of the ASP.NET MVC framework. It uses the Session to persist data from one request to another, typically after a redirect.
    It's used to populate the file list in the example.

    Regards,
    T. Tsonev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready