I have a custom webpart page which is used to enter some input data which eventually gets saved as a List item. Now i want to add a control to that page which enables user to upload attachments to the same list item. Currently after the data is saved as list item i am enabling a link on the page which will open the default "/_layouts/AttachFile.aspx" page for that particular item id. But is there any better way in which the user can add attachment and data together, so that user does not have to submit data first , Save and then add attachment.

1 Answer 1


you can use HTML file upload control to select the document from local system.

<input type='file'

After that use javascript CSOM to create list item with the attachment. For this please see the link at the end. The below link shows both the methods : one to upload text file and another to upload non-text file.

Can't upload a non-text file to SharePoint App via REST API

  • It worked perfect..!!
    – Unnie
    Mar 6, 2014 at 11:03

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.