你的数据库是什么。
sqlser2000与oracle不同的

解决方案 »

  1.   

    sqlser2000使用img类型字段oracle则使用blob字段比较好,需要安装一个插件你可以在csdn搜索blob
      

  2.   

    我理解错了
    <tr><td class="tableTop" vAlign="bottom" align="middle" background="image/topbg_table.gif" height="20">
    <INPUT id="upfile" style="WIDTH: 444px; HEIGHT: 22px; BACKGROUND-COLOR: gainsboro" type="file" size="54" runat="server" NAME="upfile">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    <asp:button id="Button_up" runat="server" Width="74px" Text="上传"></asp:button>
    </td>
    </tr>
    然后,在按钮click事件里面
    private void Button_up_Click(object sender, System.EventArgs e)
    {
    if(this.upfile.PostedFile!=null)
    {
    string FileName=this.upfile.PostedFile.FileName;
    int num=FileName.LastIndexOf('\\');
    if(num>=0&&FileName.Length-num-1>0)
    {
    FileName=FileName.Substring(num+1,FileName.Length-num-1);
    }
    else{
    return;
    }
    string FileType=this.upfile.PostedFile.ContentType;
    System.IO.Stream fs=this.upfile.PostedFile.InputStream;
    Byte[] b=new Byte[fs.Length];
    fs.Read(b,0,b.Length);
    fs.Close();
    string path=Server.MapPath("")+"\\myFile\\"+FileName;
    FileStream fileStream=new FileStream(path,FileMode.Create,FileAccess.Write);
    fileStream.Read(b,0,b.Length);
    fileStream.Flush();
    }
      

  3.   

    Imports System
    Imports System.IOPublic Class ClassFile    Inherits System.Web.UI.Page    Public FileName As String = "file_name"
        Public FileNameNew As String = "file_name_new"
        Public FilePath As String = "file_path"
        Public FileSize As String = "file_size"
        Public FileType As String = "file_type"
        Public drFileInfo As DataRow    ' 功能:得到上传文件的基本信息
        Public Function GetFileInfo(ByVal HtmlInputFile As HtmlInputFile, ByVal FolderForSaveFile As String) As Boolean        Dim strFolder As String             ' 文件要保存的文件夹名称
            Dim strFilePath As String           ' 文件路径
            Dim strFileName As String           ' 文件上传前的名称
            Dim strFileNameNew As String        ' 文件上传后存储到硬盘的名称
            Dim arrFileName() As String         ' 分离文件名称的数组
            Dim strFileType As String           ' 文件类型
            Dim arrFileType() As String         ' 分离文件类型的数组
            Dim lngFileSize As Long             ' 文件大小        Dim strAttachNamePre As String      ' 保存后的文件名前缀
            Dim strAttachNameSuf As String      ' 保存后的文件名后缀
            Dim strAttachPathRel As String      ' 保存后的文件相对路径        Dim intCount As Integer             ' 循环计数器
            Dim dtFileInfo As New DataTable()        dtFileInfo.Columns.Add(New DataColumn(FileName, GetType(String)))
            dtFileInfo.Columns.Add(New DataColumn(FileNameNew, GetType(String)))
            dtFileInfo.Columns.Add(New DataColumn(FilePath, GetType(String)))
            dtFileInfo.Columns.Add(New DataColumn(FileSize, GetType(Long)))
            dtFileInfo.Columns.Add(New DataColumn(FileType, GetType(String)))        If Not (HtmlInputFile.PostedFile Is Nothing) Then            HtmlInputFile.Visible = True
                ' 上传的文件不能大于10MB
                If HtmlInputFile.PostedFile.ContentLength() > 10 * (1024 * 1024) Then            End If
                strFilePath = HtmlInputFile.PostedFile.FileName()
                If strFilePath = "" Then
                    Return False
                Else
                    strFilePath = Replace(strFilePath, "/", "\")
                    strFilePath = Replace(strFilePath, "//", "\")
                    strFilePath = Replace(strFilePath, "\\", "\")
                End If
                '取得上传的文件名
                For intCount = Len(strFilePath) To 1 Step -1
                    If Mid(strFilePath, intCount, 1) = "\" Then
                        strFileName = Right(strFilePath, Len(strFilePath) - intCount)
                        Exit For
                    End If
                Next
                '文件类型
                strFileType = HtmlInputFile.PostedFile.ContentType()
                '文件大小
                lngFileSize = HtmlInputFile.PostedFile.ContentLength()
                If lngFileSize <= 0 Then
                    Return False
                End If
                '取当前时刻作为保存后的文件名前缀
                strAttachNamePre = Year(Now()) & Month(Now()) & Day(Now()) & Hour(Now()) & Minute(Now()) & Second(Now()) & HtmlInputFile.ID
                '取得文件名后缀
                arrFileName = Split(strFileName, ".")
                intCount = UBound(arrFileName)
                If intCount < 1 Then
                    strAttachNameSuf = ""
                Else
                    strAttachNameSuf = "." & arrFileName(intCount)
                End If
                If strAttachNameSuf = "" Then
                    Return False
                End If
                ' 文件名
                strFileNameNew = strAttachNamePre & strAttachNameSuf
                ' 对文件夹进行处理
                strFolder = FolderForSaveFile            If Right(strFolder, 2) = "//" Then
                    strFolder = Left(strFolder, Len(strFolder) - 2)
                ElseIf Right(strFolder, 1) = "/" Then
                    strFolder = Left(strFolder, Len(strFolder) - 1)
                ElseIf Right(strFolder, 2) = "\\" Then
                    strFolder = Left(strFolder, Len(strFolder) - 2)
                ElseIf Right(strFolder, 1) = "\" Then
                    strFolder = Left(strFolder, Len(strFolder) - 1)
                End If
                Me.GetFolderPathAbs(strFolder)
                ' 文件相对路径
                strAttachPathRel = strFolder & "/" & strFileNameNew            drFileInfo = dtFileInfo.NewRow
                drFileInfo(FileName) = strFileName
                drFileInfo(FileNameNew) = strFileNameNew
                drFileInfo(FilePath) = strAttachPathRel
                drFileInfo(FileSize) = lngFileSize
                drFileInfo(FileType) = strFileType
                dtFileInfo.Rows.Add(drFileInfo)
                Return True
            Else
                Return False
            End If    End Function
    End Class这里得到上传文件的类,参数为:控件名与文件保存路径
    返回值:false没有文件上传;true有并可得到文件的一些信息