Let me explain you clearly! its funny.
I have two systems:
1) server (MOSS)
2) my local machine
I developed a web part in server which uploads a file into a custom lists.
It checks whether the file exists in the system
-- if exists, it allows to add it to a custom list
-- if not exists, it will show a message "File Not Exists"
its working fine in the server.
But when i am uploading a file in my local machine it is showing the message
"File Not Exists"
I copied the path of a file from server and I opened my web part page in my
local machine, and pasted the file path in the web part and uploaded.
Surprisingly, it uploaded the file successfully. That means it is checking the
file only in the server, not from the local machine. Why it is doing like this?
I need to get files from local machine from which the web part page is
accessing.
Can any one help me. Thanks in advance...
Code:
if
{
{
fileStream.Read(contents, 0, (
fileStream.Close();
spAttachmentCollection.Add(fileName, contents);
newItem.Update();
ClearAll();
lblError.Text =
}(FileUpload1.Value != string.Empty)
if(File.Exists(FileUpload1.Value)) FileStreamfileStream =
File.OpenRead(FileUpload1.Value); stringfileName =
fileStream.Name.Substring(3); byte[] contents =
newbyte[fileStream.Length];int)fileStream.Length);
SPAttachmentCollectionspAttachmentCollection = newItem.Attachments;"Issue Raised
Successfully!"; else {
lblError.Text =
}
}"File Not Exists!";