在“母版"页面中上传文件 [英] File Upload in Master page

查看:53
本文介绍了在“母版"页面中上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个困难.

我想做的就是这个;我正在尝试从本地计算机上载任何文件,并将其保存在应用程序文件夹中.
但是当我不得不尝试上传文件时,FileUpload控件无法获取文件名.

下面的代码在简单的页面(没有母版)中可以正常工作:

Hi,

I have one difficulty.

What I am trying to do is this; I am trying to upload any file from local machine and save it in an application folder.
But when I have to try to upload file, the FileUpload control cannot get the file name.

The following code works fine in a simple page (without master):

if (FileUpload1.HasFile) 
{          
  String fileName = FileUpload1.FileName;
  savePath += fileName;                
  FileUpload1.SaveAs(savePath);                
  UploadStatusLabel.Text = "Your file was saved as " + fileName;
}            
else
{                
  // Notify the user that a file was not uploaded.
  UploadStatusLabel.Text = "You did not specify a file to upload."; 
} 


所以,请给我建议和


So, please give me suggestions & if possible the complete way of doing this.

推荐答案

看看这个.

包含母版页,Ajax更新面板,FormView和对象数据源的文件上传 [
Have a look at this.

FileUpload with Master Page, Ajax Update Panel, FormView and Object Data Source[^]


这篇关于在“母版"页面中上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆