views:

2052

answers:

5

i need a solution to display open file dialog in html while clicking a div . the open file dialog box must open when the div is clicked.

note : i dont want to display the input file dialog as part of html page. it must be displayed as alert in javascript.

[i need open file dialog box when a div is clicked. it must be as like alert which is not part of the web page]

+1  A: 

AFAIK you still need an <input type="file"> element, then you can use some of the stuff from quirksmode to style it up

Dan F
+3  A: 

Here is a nice one

Ajax upload for jQuery demo

It is an <input type='file' /> control itself. But a div is placed over that and css styles are applied to get that feel. Opacity of the file control is set to 0 so that it appears that the dialog window is opened when clicking on the div.

rahul
+1  A: 

The only without <input type="file"> is by embedding a transparent flash movie over the div. You can then use a user generated click event (compliant with Flash 10 new security rules) to trigger a call to flash's FileReference.browse.

It offers an added dependency over the quirksmode way but in return you get alot more events (such as built in progress events).

Martijn Laarman
A: 

May be you might be interested this: http://code.google.com/p/upload-at-click/

At click on element will be opened 'Open file' dialog and

run custom function.

Vitaly Fadeev