回发后如何获取或保留文件上载控制值 [英] how to get or retain file upload control value after postback

查看:35
本文介绍了回发后如何获取或保留文件上载控制值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只有一个文件上传控件的用户控件,该用户控件位于Tabs页面上的Tab容器内.层次结构就像下面这样:

hi i have usercontrol on which there is one file upload control, user control is inside Tab container which on aspx page.hirarchy is like bellow:

1.母版页2.aspx具有ajax选项卡控件的页面.3.位于标签容器内的用户控件.4.文件上传控件在用户控件上.并提交按钮

1.Master Page 2.aspx Page having ajax tab control. 3.User control which is inside tab container. 4.file upload control which is on user control. and submit button

我面临的问题:当我单击提交按钮时,调用页面加载事件之前,文件上传控件的单击事件中的按钮值变为null.

Problem i am facing: When i click on submit button as page load event is called before buttons on click event value of file upload control is getting nulll.

能否请您告诉我在回发后如何获取文件上传控件的值.谢谢.

could you please tell me how can i fetch the file upload control value after postback. thanks is advance.

推荐答案

文件上载控件不会在每个请求中都保留发布的文件.
当用户选择文件时,该文件将在下一个发生的PostBack请求中可用.

The file upload control does not retain the posted file with each request.
When the user selects a file, it will be available in the next PostBack request that occurs.

您应检查 PostedFile在每次回发上,然后将此文件保存在服务器上.
在ViewState中保留对其路径的引用.
然后,当用户完成所有输入后,您就可以处理文件了.

You should check for a PostedFile on each postback and save this file on the server.
Keep a reference to its path in the ViewState.
Then you can process the file when the user has finished all inputs.

这篇关于回发后如何获取或保留文件上载控制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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