1

I have an ASP.NET web application and on specific page user can add an entry, together with two images. Up until now I have came across many great working jQuery plugins, which can be easily integrated and used for upload. I found this one http://pixelcone.com/jquery/ajax-file-upload-script/ perfect for my needs, it just needs to be cloned.

But the question is: how can I create multiple instances (two in this case) of the same plugin? Just to be clear, I need two plugins which upload a single image each to their location (plugin1->location 1; plugin2->location2).

P.S. By talking about 'two instances' I mean two separate forms as well (not one form with multiple files).

Any comments would be greatly appreciated!

1 Answer 1

0

Use two different selectors when you call the plugin.

e.g.

    $('.fileUploadOne, .fileUploadTwo').fileUploader();

<input type="file" name="file" class="fileUploadOne" multiple>
<input type="file" name="file" class="fileUploadTwo" multiple>

And update your controllers properly with the correct params you want to files to go to.

3
  • You could try using two different actions on the form. Do you get any JS errors in the console with running the plugin in multiple instances? Commented Apr 4, 2012 at 22:58
  • That's the funny part: no errors. The only thing is that the first instance has disabled 'submit' and 'clear' buttons. And when I choose a file, the bottom div doesn't appear... Oh, and I tried with different actions (I just cloned the current ashx handler and renamed it), but the result is the same. The issue is before the form is submitted.
    – Spartak
    Commented Apr 4, 2012 at 23:08
  • And I might not stated this clearly before, but by two instances I also mean two forms. I'll update the first post.
    – Spartak
    Commented Apr 4, 2012 at 23:16

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.