Sep 17, 2010, 2:31 PM
Missing SaveAs Function FileUpload Field
Hi there,
we would like to implement a sharepoint upload function, but we are missing the SaveAs Function in the FileUploadField as we have it in an ASP.Control like this:
string uploadedFilePath = @"C:\Temp\Uploads\";
string sharePointListPath =
"http://<Server>/<ListName>/";
if (FileUpload1.HasFile)
try
{
FileUpload1.SaveAs(
uploadedFilePath + FileUpload1.FileName);
Label1.Text = "File name: " +
FileUpload1.PostedFile.FileName + "<br>" +
FileUpload1.PostedFile.ContentLength + " bytes<br>" +
"Content type: " +
FileUpload1.PostedFile.ContentType;
UploadFileToSharePoint(
uploadedFilePath + FileUpload1.FileName,
sharePointListPath + FileUpload1.FileName);
}
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
else
{
Label1.Text = "You have not specified a file.";
}
}
thx BLOZZY
we would like to implement a sharepoint upload function, but we are missing the SaveAs Function in the FileUploadField as we have it in an ASP.Control like this:
string uploadedFilePath = @"C:\Temp\Uploads\";
string sharePointListPath =
"http://<Server>/<ListName>/";
if (FileUpload1.HasFile)
try
{
FileUpload1.SaveAs(
uploadedFilePath + FileUpload1.FileName);
Label1.Text = "File name: " +
FileUpload1.PostedFile.FileName + "<br>" +
FileUpload1.PostedFile.ContentLength + " bytes<br>" +
"Content type: " +
FileUpload1.PostedFile.ContentType;
UploadFileToSharePoint(
uploadedFilePath + FileUpload1.FileName,
sharePointListPath + FileUpload1.FileName);
}
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
else
{
Label1.Text = "You have not specified a file.";
}
}
thx BLOZZY