フォルダのアクセス許可は適切です。エラーは発生しません。下のこの関数を呼び出すアップロードボタンをクリックします。それが完了すると、アップロードしたファイルがそこにありません。何か案は?ありがとう!
protected void submitFile(object sender, EventArgs e){
if(fileUpload.HasFile)
{
try
{
if(
fileUpload.PostedFile.FileName.ToLower().Substring(fileUpload.PostedFile.FileName.Length - 3) == "doc" ||
fileUpload.PostedFile.FileName.ToLower().Substring(fileUpload.PostedFile.FileName.Length - 4) == "docx")
{
if(fileUpload.PostedFile.ContentLength < 512000)
{
string filename = Path.GetFileName(fileUpload.FileName);
filename = filename.Replace(" ", "");
fileUpload.SaveAs("C:/inetpub/ ------ directory --------/Data" + filename);
StatusLabel.Text = "Upload status: File uploaded complete.";
}
else
StatusLabel.Text = "Upload status: The file has exceded the maximum file size of 500 kb. Please ensure that the file is smaller than 500 kb and try again";
}
else
StatusLabel.Text = "Upload status: Only PDF and Microsoft Word files are accepted. Please try again.";
}
catch(Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
}