I am using SPO. I would like to be able to drag and drop a document file (.pdf etc) to a new list item when using the New Item Form, rather than utilising the attach button from the ribbon and needing to browse for the file. Does ayone know if this is possible and the solutions available?
When you get file data, insert file to list item as attachment by REST API.
url: http://site url/_api/web/lists/getbytitle('list title')/items(item id)/AttachmentFiles/ add(FileName='file name') method: POST headers: Authorization: "Bearer " + accessToken body: "Contents of file." X-RequestDigest: form digest value content-length:length of post body
Here are some threads for your reference. http://www.sharepointyammertech.com/2015/04/How-to-upload-attachments-to-SharePoint-list-item-using-REST-services.html https://msdn.microsoft.com/en-us/library/office/dn292553%28v=office.15%29.aspx#FileAttachments