图片上传出错!急!!!! 看看你的FORM里面有没给form 指定enctype 属性 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 将HttpPostedFile upFile =up_file.PostedFile;int iFileLength = upFile.ContentLength;改成:int iFileLength = up_file.PostedFile.ContentLength; http://www.chinabs.net/aspnet/default.asp?infoid=73 另外,在.aspx文件中:(添加enctype="multipart/form-data")<form id="Form1" method="post" runat="server" enctype="multipart/form-data">在.aspx.cs中:using System.IO; <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><%@ Page language="c#" Codebehind="default.aspx.cs" Inherits="MobileWebApplication17.MobileWebForm1" AutoEventWireup="false" %><HEAD> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" content="C#"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/Mobile/Page"></HEAD><body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm"> <mobile:Form id="Form1" enctype="multipart/form-data" runat="server"> <FONT face="宋体"><mobile:Label id="Label1" runat="server" Alignment="Center" Font-Name="Arial">图片上传系统</mobile:Label><mobile:Label id="Label2" runat="server">请输入要上传编号:</mobile:Label><mobile:TextBox id="TextBox1" runat="server"></mobile:TextBox><mobile:Label id="Label3" runat="server">请选择要上传的图片:</mobile:Label><mobile:Command id="Command1" runat="server">上传</mobile:Command> </FONT> <mobile:Panel id="Panel2" runat="server"> <asp:Panel id="Panel1" runat="server">Panel<BR> <BR> <INPUT id="up_file" type="file" name="up_file" runat="server"> <BR></asp:Panel> </mobile:Panel> </mobile:Form></body>去掉enctype="multipart/form-data",还是错的,,我现在用的是移动控件,在做移动asp.net的项目,遇到麻烦了,希望大家可以帮我,谢谢! 移动上面是不能用HtmlInputFile,你可以采用TCP传输或试试WINSock.. repeater中绑定图片地址 获取客户端的IP地址的疑问 我刚装好IIS,然后浏览网站后就HTTP500错误 请问有谁可以告诉我一本旧书《Asp.Net PRO 2002-2003中文精华合集》【第1辑】随书光盘的内容? 请问如何捕获sqldatasource的异常? 新手请教!请高手赐招! 准备把自己的项目ZForums论坛源码提供出来 装了VS2005后数据库企业管理器里打不开数据库了 询问关于IIS配置出现的问题,怎么解决呀 ext.net 请帮帮我吧,关于Parameters的问题 我输入的字符中的回车为什么会不见了?急!!!
HttpPostedFile upFile =up_file.PostedFile;
int iFileLength = upFile.ContentLength;
改成:
int iFileLength = up_file.PostedFile.ContentLength;
在.aspx文件中:(添加enctype="multipart/form-data")
<form id="Form1" method="post" runat="server" enctype="multipart/form-data">在.aspx.cs中:
using System.IO;
<%@ Page language="c#" Codebehind="default.aspx.cs" Inherits="MobileWebApplication17.MobileWebForm1" AutoEventWireup="false" %>
<HEAD>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="C#">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/Mobile/Page">
</HEAD>
<body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm">
<mobile:Form id="Form1" enctype="multipart/form-data" runat="server">
<FONT face="宋体">
<mobile:Label id="Label1" runat="server" Alignment="Center" Font-Name="Arial">图片上传系统</mobile:Label>
<mobile:Label id="Label2" runat="server">请输入要上传编号:</mobile:Label>
<mobile:TextBox id="TextBox1" runat="server"></mobile:TextBox>
<mobile:Label id="Label3" runat="server">请选择要上传的图片:</mobile:Label>
<mobile:Command id="Command1" runat="server">上传</mobile:Command> </FONT>
<mobile:Panel id="Panel2" runat="server">
<asp:Panel id="Panel1" runat="server">Panel<BR>
<BR>
<INPUT id="up_file" type="file" name="up_file" runat="server">
<BR></asp:Panel>
</mobile:Panel>
</mobile:Form>
</body>去掉enctype="multipart/form-data",还是错的,,
我现在用的是移动控件,在做移动asp.net的项目,遇到麻烦了,希望大家可以帮我,谢谢!