看看你的FORM里面有没给form 指定enctype 属性

解决方案 »

  1.   


    HttpPostedFile upFile =up_file.PostedFile;
    int  iFileLength = upFile.ContentLength;
    改成:
    int iFileLength = up_file.PostedFile.ContentLength;
      

  2.   

    http://www.chinabs.net/aspnet/default.asp?infoid=73
      

  3.   

    另外,
    在.aspx文件中:(添加enctype="multipart/form-data")
    <form id="Form1" method="post" runat="server" enctype="multipart/form-data">在.aspx.cs中:
    using System.IO;
      

  4.   

    <%@ 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>&nbsp;&nbsp;</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的项目,遇到麻烦了,希望大家可以帮我,谢谢!
      

  5.   

    移动上面是不能用HtmlInputFile,你可以采用TCP传输或试试WINSock..