c# - How to upload a file to a document library given a HttpPostedFile -
c# - How to upload a file to a document library given a HttpPostedFile -
i have httppostedfile object , after file gets uploaded locally onto server, want move temp file document library in sharepoint. here code:
private void uploadwholefile(httpcontext context, list<filesstatus> statuses) { (int = 0; < context.request.files.count; i++) { httppostedfile file = context.request.files[i]; file.saveas(ingestpath + path.getfilename(file.filename)); string filename = path.getfilename(file.filename); } can give me illustration code this? have found tutorial streams, not quite sure if work same in situation
replace 2 lines starting file.saveas following:
var mydocumentlibrary = spcontext.current.web.folders["mydocumentlibrary"]; var myfile = mydocumentlibrary.files.add(file.name, file.filecontent, true); c# asp.net sharepoint
Comments
Post a Comment