I'm working on a Sharepoint 2013 aspx form that submits the data to a list and would like to add an attachment upload control because users will not have access to the top ribbon.

Below code is what I'm using to insert the control and it works fine, but the issue I'm having is duplicating it.

        <div id="profilePicture"></div>

        <input type="file" name="fileupload0" id="onetidIOFile" class="ms-fileinput" style="" title="Name" />


When I create a second control (same code above, but with name="fileupload1"), the buttons for the controls will both look at the fileupload0. So the second control will not work until the first one has been used.

Is there a way to create them independent of each other?

Hope I explained the issue well, thanks in advance!

  • 1
    Change the id also.
    – Aanchal
    Sep 29, 2014 at 5:44

1 Answer 1


I am using for this kind of problem on my custom list form a solution similar to the one shown here: http://sptechytalks.wordpress.com/2013/01/04/part-1-introduction-multiple-attachment-custom-control-uploads-them-in-sharepoint-document-libraries/

The differences are:

1) I am using an IFRAME to host the control for refreshing attached files

2) Specifically for your kind of problem, to handle multiple control instances on a page I have a separate column 'ControlID' in storing Document Library, which holds the ID of the specific control on the page.

  • very interesting! how did you achieve this?
    – habibg
    Sep 29, 2014 at 13:38
  • as shown here I have a separate document library for storing attachments, which has fields 'Title', 'Guid' and 'ControlId'. check out the implementation on that page. also, my control is more generic.
    – n0e
    Sep 29, 2014 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.