页面刷新时,我的文件上传控制路径被清除了 [英] when page is refreshing my fileupload control path gets cleared
本文介绍了页面刷新时,我的文件上传控制路径被清除了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
Iam正在上传文件.
页面刷新时,我的文件上传正在清除.
我在页面加载中编写了以下代码,但无法正常工作.
Hi
Iam uploading the file.
When page is gets refreshing my fileupload is clearing.
I write the below code in page load but it is not working.
FileUpload1.Attributes.Add("Value",FileUpload1.FileName);
or
Session["path"] = FileUpload1.FileName;
给我一些解决问题的建议.
糟糕....我要在上传完成后将其清除.... Yaar!但是在页面上刷新其再次显示hasfile true ... ??? [/EDIT]
give me suggestions to clear the problem.
oops.... i wants to clear it once upload complete....Yaar! but on page refresh its again showing hasfile true...??? [/EDIT]
推荐答案
您无法保留文件上载控件的值,每次呈现页面时该控件将为空.为什么要保留它的值?
You can''t retain the value of a file upload control, it will be empty every time the page is rendered. Why do you want to retain it''s value ?
您不能这样做.重新加载页面后,它将丢失文件名
you cant do that. once the page is reloaded it will lose the file name
在表单标签中使用enctype ="multipart/form-data".
< form id ="form1" runat ="server" enctype ="multipart/form-data">这样可以保持您的价值.
Use enctype="multipart/form-data" in form tag.
<form id="form1" runat="server" enctype="multipart/form-data"> This maintain your value.
这篇关于页面刷新时,我的文件上传控制路径被清除了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文