uploadifive trigger file open dialog box

566 Views Asked by At

I am using the uploadifive jquery plugin for uploading obituary mugshots. Instead of using the usual uploadifive-generated button, I would like the user to be able to double-click on the placeholder image and have that trigger the file dialog box. I want to hide all the other uploadify elements.

I am able to use this:

$( "input:file" ).trigger('click');

and this opens the dialog box, but when I choose a file, the dialog box opens again 2-3 more times.

Is there an even that I can fire this so that it works correctly?

1

There are 1 best solutions below

0
On

I had the same problem.

Looking at the code I discovered that UploadiFive create a new input field (type="file") each time you upload a file. Due to this behavior is impossible to trigger the event like you are currently doing.

My solution is to always trigger only the last created input field

$( 'input[type="file"]' ).last().click();

Hope it helps ;-)