是word文件,由于安全方面的考虑,不能直接存放到数据库中

解决方案 »

  1.   

    使用vb.net将文件上传给一个asp.net页面
    ----不懂你具体要做什么要加密文件内容?
      

  2.   

    具体的说,我要将一个指定的文件上传到web服务器上。使用<input type=file>不能指定文件名,而必须要用户选择。因此使用嵌入网页的windows控件,但是又老是不成功。代码如下:
       '*保存正文信息
        Public Function Save() As Boolean
            Dim objDocContent As Object
            Dim dsDoc As DataSet
            Dim drow As DataRow
            Try
                'dsDoc = New DataSet()
                'dsDoc.Tables.Add("DocContent")
                'dsDoc.Tables(0).Columns.Add(STR_PARAMETER_TABLE_NAME, Type.GetType("System.String"))
                'dsDoc.Tables(0).Columns.Add(STR_PARAMETER_RECORDID_NAME, Type.GetType("System.String"))
                'dsDoc.Tables(0).Columns.Add(STR_PARAMETER_DOC_NAME, Type.GetType("System.Object"))
                'drow = dsDoc.Tables(0).NewRow
                'drow(STR_PARAMETER_TABLE_NAME) = mstrTableName
                'drow(STR_PARAMETER_RECORDID_NAME) = mintRecordId.ToString.Trim
                objDocContent = ReadFileToObject(mstrLocalDocName)
                'drow(STR_PARAMETER_DOC_NAME) = System.Convert.ToBase64String(objDocContent, _
                '                                       0, _
                '                                       objDocContent.Length)
                'drow(STR_PARAMETER_DOC_NAME) = ReadFileToObject(mstrLocalDocName)
                'dsDoc.Tables(0).Rows.Add(drow)
                'objDocContent = dsDoc.GetXml()
                Dim ls As HttpWebRequest
                Dim rs As Stream
                ls = Net.WebRequest.Create(mstrHttpFilePath & mstrSaveDocAsp)
                ' 设置某些 WebRequest 属性
                ls.Method = "POST"
                ls.ContentType = "garl.doc"
                rs = ls.GetRequestStream
                Dim tt() As Byte
                tt = objDocContent
                MsgBox("ok")
                rs.Write(tt, 0, tt.Length)
                rs.Close()            '*删除已经下载的文档
                'DeleteFile()
            Catch ex As Exception
                Prompt("保存正文信息失败!" & Chr(13) _
                     & "    原因如下:" & Chr(13) _
                     & "    " & ex.Message)
                Save = False
            Finally
                drow = Nothing
                'dsDoc.Dispose()
                dsDoc = Nothing
                objDocContent = Nothing
            End Try
        End Function
      

  3.   

    嵌入网页的windows控件也有安全性限制的
      

  4.   

    namespace KumsalNet.WoiseUpload{
     using System;
     using System.Net;
     using System.Windows.Forms; class MainForm : Form
     {  public MainForm()
      {
       Text = "Plase Select and Upload File Wave File";  System.Windows.Forms.Button button1;     button1 = new System.Windows.Forms.Button();  button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            button1.Location = new System.Drawing.Point(20, 20);
            button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            button1.Size = new System.Drawing.Size(100, 26);
            button1.TabIndex = 5;
            button1.Text = "TestButton";
            button1.Click += new System.EventHandler(button1_Click);
            this.Controls.Add(button1);
      }
         private void button1_Click(object sender, EventArgs e) {
           // MessageBox.Show("You pressed the test button") ;      FileUpload fileupload= new FileUpload(@"c:\faturalar.zip",new
    Uri("http://localhost:8080/SaweFie.aspx"));
          MessageBox.Show(fileupload.Send().ToString());
         }  public static void Main(string[] args)
      {
       Application.Run(new MainForm());
      }
     } public class FileUpload{  WebClient WC;
      string File;
      Uri Url;  public FileUpload(string Dosya,Uri Hedef)
      {
        WC=new WebClient();
        File =Dosya;
        Url=Hedef;
      }
      public bool Send(){
       try{
        WC.UploadFile(Url.ToString(),"POST",File);
        return true;
       }
       catch(Exception exx)
       {
        Console.WriteLine(exx.Message);
        return false;
        /*if(e.Message.Length>0)
        {
         MessageBox.Show(e.Message);
        }*/   }  }
     }}SaweFie.aspx  is there ...
    <%@ Page Language="C#" %>
    <script runat="server">    // Insert page code here
        //    void Page_Load(Object sender, EventArgs e) {
        try {
                foreach(string postedfile in Request.Files)
                {
                HttpPostedFile file=
                Request.Files.Get(postedfile);
                file.SaveAs(@"c:\dodnet\"+file.FileName);
                }
            }
            catch(Exception Ex)
            {
            Response.Write(Ex.Message);
            }    }</script>
    <html>
    <head>
    </head>
    <body>
        <form runat="server">
            <!-- Insert content here -->
        </form>
    </body>
    </html>
      

  5.   

    http://www.csdn.net/Expert/TopicView1.asp?id=1084653
    http://www.csdn.net/Expert/TopicView1.asp?id=1081220
    也请zeaing回答一下吧!