Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Upload Attachmnt Issue

$
0
0
Hi All,

I am facing an issue with uploading file, When I try to upload attachment from server with the below code the attachment uploaded successfully, but when I try to upload outside the server, it is throwing the exception "Can't find the path".

                string strFileName = txtPath.Text;                
                FileStream stream = new FileStream(txtPath.Text, FileMode.Open, FileAccess.Read); // Exception thrown here
                byte[] byteArray = new byte[stream.Length];
                stream.Read(byteArray, 0, Convert.ToInt32(stream.Length));
                stream.Close();
                requestItem.Attachments.Add(strFileName, byteArray);
    
Please help me on this issue.

Regards,
Kumar.

Viewing all articles
Browse latest Browse all 11508

Trending Articles