您的位置:程序门 -> .net技术 -> asp.net



fileupload控件问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


fileupload控件问题
发表于:2007-08-08 11:20:49 楼主
我用的2.0   筐架

但我在上传时已经选择好了上传文件了   fileupload.postedfile   为空  
在调试状态下   抱这异常   readtimeout   和     writetimeout(次流不支持超时)   fileupload.filecontent.readtimeout”引发了“system.invalidoperationexception”类型的异常

我分析:
由于异常导致了fileupload.postedfile   为空不能取到上传数据的信息

怎么解决也??
发表于:2007-08-08 13:59:351楼 得分:0
上传文件多大,默认4m,改一下httpruntime元素的maxrequestlength
发表于:2007-08-08 14:59:592楼 得分:0
同意楼上


默认有限制的
发表于:2007-08-08 15:08:193楼 得分:0
只是小于100k的图片

      {
     
                random   myrd   =   new   random();
                string   path,   filename,   upfilepath; //上传文件路径,上传文件名称
                path   =   server.mappath( "~/upfile/users/ ");
                filename   =   datetime.now.tostring().replace( "- ",   " ").replace( ": ",   " ").replace( "   ",   " ")   +   myrd.next(1000).tostring(); //上传文件名称


                string   fileextension   =   system.io.path.getextension(fileupload.postedfile.filename).tolower();
报错   fileupload.postedfile.filename   出错   fileupload.postedfile   是null  

在调试状态下   抱这异常   readtimeout   和     writetimeout(次流不支持超时)   fileupload.filecontent.readtimeout”引发了“system.invalidoperationexception”类型的异常

发表于:2007-08-08 15:50:354楼 得分:0
这是我写的,不知道对你有没有帮助,我是把图片上传到服务器,数据库只存文件名
strfilename6   =   fileupload6.postedfile.filename;
                strfilename6   =   system.io.path.getfilename(strfilename6);
                if   (strfilename6.equals( " "))
                {
                        strfilename6   =   "noimg.gif ";
                        string   url6   =   server.mappath( "~/img/epimg/ ")   +   strfilename6;
                        fileupload6.postedfile.saveas(url6);
                }
                else
                {
                        string   url6   =   server.mappath( "~/img/epimg/ ")   +   strfilename6;
                        fileupload6.postedfile.saveas(url6);
                }
发表于:2007-08-09 10:47:345楼 得分:0
没用的
fileupload6.postedfile是空对象   怎么也取不到数据
发表于:2007-08-23 17:00:116楼 得分:0
我的也是这样的,如果将fileupload放在contentplaceholder中的话,那么怎么也取不到文件,如果放在正常的文件下的话,就一切ok,真不知道是什么原因


快速检索

最新资讯
热门点击