在updatepanel面板中使用fileupload上传图片
来源:互联网 发布:数据新闻论文提纲 编辑:程序博客网 时间:2024/06/10 03:09
By default, FileUpload control will not work inside an UpdatePanel control for uploading files using Asynchronous postback. This is because, the file uploading and file manipulations is restricted by default in client side for security reasons. Hence it is not possible to upload files using asynchronous postback in UpdatePanel.
To upload files inside UpdatePanel control we need to rely upon a standard postback i.e. we need to set the button that is uploading the file to be PostBack trigger instead of AsyncPostBack trigger. This will initiate a normal postback whenever we click the upload button and it is possible to upload the file.
Refer the below code for clear understanding,
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="fuUpload" runat="server" />
<asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
</asp:UpdatePanel>
protected void btnUpload_Click(object sender, EventArgs e)
{
string filename = System.IO.Path.GetFileName(fuUpload.FileName);
fuUpload.SaveAs("C:/temp" + filename);
}
To simulate an AJAX file upload we can use iframes. In this approach, the page that is contained in the iframe will contain the FileUpload control and it will be posted with a normal postback to the server and hence provides a feeling like AJAX request. We will see about this in future code snippets.
- 在updatepanel面板中使用fileupload上传图片
- Fileupload 如何在updatepanel中上传文件
- 在UpdatePanel上使用FileUpload上传文件
- 在UpdatePanel上使用FileUpload上传文件
- 在UpdatePanel上使用FileUpload上传文件 (asp.net C#)
- ASP.NET在IE7中使用FileUpload上传预览图片
- UpdatePanel内使用FileUpload上传…
- UpdatePanel中使用FileUpload的变通方法
- asp.net在ie7中使用FileUpload上传前预览图片
- asp.net在ie7中使用FileUpload上传前预览图片
- asp.net在ie7中使用FileUpload上传前预览图片
- asp.net在ie7、ie8中使用FileUpload上传前预览图片(简单好用)
- UpdatePanel里使用FileUpload
- FileUpload控件上传图片并保存在文件夹中
- UpdatePanel+FileUpload无刷新上传
- servlet中使用commons-fileupload实现图片上传
- 使用UpdatePanel时FileUpload失效的问题!【FileUpload上传文件失败】
- 在jsp中使用commons-fileupload将图片上传至mysql数据库,再用servlet将其显示
- 先随便来一个
- C++/C语言探底巩固
- 关于修改Oracle服务器IP及端口时要注意的问题
- PHP实例:FCKeditor 的配置和使用方法
- 查看linux系统版本是32位还是64位
- 在updatepanel面板中使用fileupload上传图片
- 网吧 开始-》运行 被禁用之破解方法
- DHCP
- e
- 怎样把桌面,我的文档,IE收藏夹设置到其他盘下?
- ResultCmd
- iphone -Objective C get tap position in UITextView
- RHEL5双网卡绑定
- 界面化安装软件包