3

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?

3
  • I don't think it is possible out of the box to drag and drop a attachment to the list.
    – Amit Kotha
    Apr 24, 2017 at 7:01
  • Ok i thought that might be the case. Are you aware of any third party paid apps or custom code solutions?
    – cr1
    Apr 24, 2017 at 7:17
  • I have the feeling provided links help to develop upload functionality. i would like to simulate the "join file" button Sharepoint functionality with a drag and drop zone. I tried using both dropzone.js and Sharepoint js functions (like OkAttach) but I failed. Any idea?
    – Dams
    Jun 19, 2017 at 20:43

1 Answer 1

0

You may try with some JavaScript libraries for this.

http://bitwiser.in/2015/08/08/creating-dropzone-for-drag-drop-file.html

https://css-tricks.com/drag-and-drop-file-uploading/

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

Lee

Your Answer

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

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