This is a migrated thread and some comments may be shown as answers.

extension exclusion and sync upload

3 Answers 147 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Gaetano
Top achievements
Rank 1
Gaetano asked on 05 Aug 2013, 01:47 PM
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

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 06 Aug 2013, 12:47 PM
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!
0
Gaetano
Top achievements
Rank 1
answered on 27 Aug 2013, 03:12 PM
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
0
Accepted
T. Tsonev
Telerik team
answered on 29 Aug 2013, 11:29 AM
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!
Tags
Upload
Asked by
Gaetano
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Gaetano
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or