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

[Solved] opening the file dialog on click

3 Answers 98 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
cp
Top achievements
Rank 1
cp asked on 04 Jan 2012, 11:50 PM
How do I go about opening the file dialog window while clicking a link for instance. I have tried $(".t-button.t-upload-button input").click(); which seems to work ok in Firefox, however in IE it opens and selecting a file does not seem to do anything - the second time around I get a "htmlfile: Access is denied" exception.

I have several links I would like to tie to the upload control, and of course I don't want to add one Upload control per instance.

EDIT: In firefox it actually seems to multiply the number of file upload windows that open every time I click one of the links.

Thanks,

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 05 Jan 2012, 09:47 AM
Hi,

This behavior in IE is by design. It's actually a security feature to disallow uploading files from JavaScript.

The best that can be done is to style the Upload to fit your UI and use multiple instances, if necessary.

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
cp
Top achievements
Rank 1
answered on 05 Jan 2012, 04:45 PM
So do you think the case below can only be accomplished by using multiple Upload controls (please see attachment):

1. A user uploads a file by using the the "Upload" button.
2. Additional files can be uploaded by clicking the "Add count script" buttons.

Thanks,

0
T. Tsonev
Telerik team
answered on 06 Jan 2012, 05:38 PM
Hello,

This is possible, if not elegant. It can be done by injecting an upload component on the fly to the file list.

A better solution would be to use the Grid as a more flexible file list that allows easy customization. We have a code library that this can be done: http://www.telerik.com/community/code-library/aspnet-mvc/upload/upload-in-grid.aspx 

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Upload
Asked by
cp
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
cp
Top achievements
Rank 1
Share this question
or