fileUpload的默认值 [英] The default value for fileUpload

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

问题描述

How can I put a default value for FileUpload.
So that you do not upload a file that is uploaded default file.

推荐答案

这样就不会上传默认文件.
如果要在用户无法提供默认文件的情况下进行默认文件上传,则只需在后面的代码中内部上传即可.使用FileUpload.HasFile属性检查是否选择了任何内容-如果未选择,请提供用于上传的默认文件路径.
So that you do not upload a file that is uploaded default file.
If you want to have a default file upload in case user fails to provide one, you can simply upload it internally in code behind. Check using FileUpload.HasFile property if anything was selected - if not, provide your default file path for upload.


在某种意义上说,您无法为上传设置默认文件如果他们未指定文件,则将从他们的系统上载该文件-您无法从服务器访问他们的计算机(甚至不知道系统是什么).

最好的办法是(如Sandeep所说)检查HasFile属性,如果它不是true,则提供服务器本地值,即null或默认的图像/空文件-对您的网站有意义.
You can''t set a default file for an upload, in the sense that if they do not specify it, you will upload that file from their system - you have no access to their computer (or even any idea what the system is) from the server.

The best you can do is (as Sandeep says) check the HasFile property and if it is not true then provide a server-local value, either a null or a default image / empty file - whatever makes sense with your site.


这篇关于fileUpload的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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