Filespload来自带有属性的cs代码文件 [英] FileUpload from cs code file with property

查看:77
本文介绍了Filespload来自带有属性的cs代码文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




当我从.aspx.cs代码文件中在asp.net中进行FileUpload控件时,它会显示hasfile false



怎么制作hasfile true



我需要使用FileUpload控件将文件保存到文件夹中



string paths = Path.Conbine(@C:/ Forms /,jackpot.jpg);

FileUpload fup = new FileUpload();

< b>

fup.Saveas(路径);



以上粗线将文件复制到文件夹..



另外,我得到文件名(imagename),来自< input type =file>



和我使用< input type =file>因为,有多个输入类型=文件附加自jquery

Hi
When i make FileUpload control in asp.net from .aspx.cs code file , it shows hasfile false

how to make hasfile true

I need to make FileUpload control to save file in folder using

string paths=Path.Conbine(@"C:/Forms/","jackpot.jpg");
FileUpload fup=new FileUpload();

fup.Saveas(paths);

the above bold line copies file to folder..

Also , i get filename(imagename) , from <input type="file">

and i use <input type="file"> because, there are multiple input type="file" which are appended from jquery

推荐答案

你不能使FileUpload.HasFile为真:用户必须启动上传,你不能从服务器上做到这一点。



想一想:如果你可以从服务器开始上传,那么你访问的任何网站都可以随时从你的PC上传任何想要的文件。安全(可以理解并且谢天谢地)阻止了这一点!
You cannot make FileUpload.HasFile true: the user has to initiate the upload, you cannot do it from the server.

Think about it: if you could start an upload from your server, then any website you visit could upload any file it wanted from your PC at any time it desired. Security (understandably and thankfully) prevents this!


这篇关于Filespload来自带有属性的cs代码文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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