RE: ASP:Upload control . Uploading into a SharePoint Document Library Subfolder and FILE NOT FOUND error
Two Issues, apparently unrelated.
I have subfolders like this /ApplicantDocuments/20 and /ApplicantDocuments/21 (where 20 and 21 are my subfolders and ApplicantDocuments is my library.
The below function is erroring with file not found, but I confirmed I'm sending the fully qualify path (i.e c:\test.txt) to System.IO.FileStream content = System.IO.File.Open(documentFileName, System.IO.FileMode.Open);
Even if it worked, looking at the code, I'm not using argument foldername. I'm passing 20 to the argument. How can I make sure it uploads into subfolder 20 of ApplicantDocuments?
The file is on my local client and I'm running Windows 7/ IE 8.
Thank you.
Just testing in test environment. Will tighten code once it works.
[code] public void UploadDocumentToSite(string foldername, string documentFileName) { SPSite siteCollection = new SPSite("https://xxxxxx"); SPWeb web = siteCollection.OpenWeb(); //SPSite.AllowUnsafeUpdates = true; //Web.AllowUnsafeUpdates = true; string Lib = "ApplicantDocuments"; SPFolder destFolder = web.GetFolder(Lib); sendmail(documentFileName+" "+foldername); System.IO.FileStream content = System.IO.File.Open(documentFileName, System.IO.FileMode.Open); destFolder.Files.Add(documentFileName, content, true); } [/code]