Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form

In this article, I’m going to explain how to use out of the box to attach multiple files with one click in the default new form of SharePoint’s custom list. So, the help of this we can choose multiple files and attach at a time instead of choosing files one by one to upload.

Introduction

In this article, I’m going to explain how to use out of the box features to attach multiple files with one click in the default new form of SharePoint’s custom list. So, with the help of this, we can choose multiple files and attach them all at once instead of choosing files one by one to upload.

Procedure Overview

  • Create a SharePoint list
  • Click on a new item
  • Apply multiple to the default attach file button in the new form

Procedure

Step 1

Click on the new item in the list, it will navigate to the default page,

Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form

In this default case, we can’t choose multiple files to attach. To do that we need to apply multiple properties to attach the file button.

Step 2

Click on Attach File, it will take you to the upload file page as below,

Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form 

Get the ID of Choose File input by inspecting the element.

Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form 

Take the ID and write the below code to apply Multiple to the attach file input.

Code

  1. document.getElementById("onetidIOFile").multiple = true;  
  2. //Where “onetidIOFile” is the Id of Chosen file input  
Now, we need to use the above piece of code in the Script Editor, along with the jQuery CDN for reference.
 
Reference
  1. <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>  
The full code here,

  1. <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>  
  2. <script>  
  3.     $(function() {  
  4.         document.getElementById("onetidIOFile").multiple = true;  
  5.     })()  
  6. </script>  

Procedure for add snippet editor,

  • Click on Edit page from Gear Icon

    Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form
  • Insert Script Editor, which is available under Media and Content.

    Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form

  • Edit Snippet and add the full code, then insert and save.

    Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form

  • Now, go to Page and Stop editing.

    That’s it, now you can choose multiple files to attach in the default new form of SharePoint list,

    Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form

Choose the multiple files and attach to a SharePoint list item, the result will be like below.

Result

Attach Multiple Files To SharePoint List Item With Default Attachment Of New Form 

Thus, we have chosen multiple files in the default new form.

Conclusion

This article will help show you you how we can use the out of the box concept to choose multiple files to attach to the SharePoint list item.

Thank You!