using Microsoft.SharePoint; //SharePoint
using System.IO; //Stream
//if Anonymous Access, document library must set to allow anonymous to add items
string strSharePointURL = "http://www.sharepoint.com";
if (txtUpload.HasFile)
{
if (txtUpload.PostedFile.ContentLength > 0)
{
//string strFileName = txtUpload.PostedFile.FileName;
string strFileName = txtUpload.FileName;
Stream fStream = txtUpload.PostedFile.InputStream;
byte[] bStream = new byte[fStream.Length];
fStream.Read(bStream, 0, bStream.Length);
fStream.Close();
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite objSite = new SPSite(strSharePointURL))
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPFolder libraryFolder = objWeb.Folders["Document_Library_Name"];
objWeb.AllowUnsafeUpdates = true;
libraryFolder.Files.Add(strFileName, bStream, true);
}
}
});
}
}
//In html code
<asp:FileUpload runat="server" id="txtUpload"/>
Thursday, April 18, 2013
[SharePoint] Upload File To Document Library Using SharePoint Object Model - Authenticate or Anonymous Access
Monday, April 15, 2013
Sunday, April 14, 2013
[MAC]: How To Burn ISO Disc Images
- Insert a blank disc.
- Start Disk Utility.
- BY: Finder -> Applications -> Utilities -> Disk Utility
- OR: LauchPad -> Other -> Disk Utility
- From the File menu, choose Open Disk Image and select the ISO to be burned.
- In the list of volumes, you will now see an item representing the ISO file. Select it.
- Click the Burn button and follow the instructions.
Subscribe to:
Posts (Atom)