回发后的文件上传问题 [英] File upload problem after postback

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

问题描述

亲爱的所有





使用FileUpload控件我试图在文件夹上上传图像,在图像框上显示所选图像然后将其与Web表单上的其他数据一起保存。问题是,只要从下拉列表中选择一个值,fileupload控件就会变空。我已经通过互联网但仍然无法解决它。请解决这个问题如何简单地解决这个问题。







问候





Amy



我的尝试:



我在网上尝试过很多文章,但仍然无法解决

Dear All


Using FileUpload Control I am trying to upload an image on a folder with displaying the selected image on image box and then save it with other data on the web forms. The problem is that as soon as I select a value from the drop downlist the fileupload control become empty. I have gone through the Internet but still unable to resolve it. please fix this how to over come this issue in simple.



Regards


Amy

What I have tried:

I have tried lot of article on the net but still unable to solve

推荐答案

任何回发都会发生清除文件上传控件中当前选择的文件,这就是出于安全原因它的工作原理。您需要将表单分为两步,选择所有非文件数据,提交该表单,然后将用户带到刚刚上传文件的页面。或者您可以使用异步上传(例如google asp.net asynch文件上传,有很多方法可以)在文件被选中后立即上传,并将其临时存储在服务器上,以便在以后可用他们提交表格。
Any postback is going to clear what file was currently selected in the file upload control, that's just how it works for security reasons. You'll need to either make the form a two-step process where you select all the non-file data, submit that form then take the user to a page where the just upload the file. Or you could use asynch uploading (google asp.net asynch file upload for examples, there are many ways to do it) to upload the file immediately after it has been selected, and store that temporarily on the server so that it is available for when they submit the form.


这篇关于回发后的文件上传问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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