vs  b/s环境下 利用socket将文件上传到服务器  不使用fileupload 控件 

解决方案 »

  1.   

    什么服务器? web 服务器? FTP 服务器?
      

  2.   

    如果是 web 服务器, 举个例子:
    对于 fileupload 控件, 实际生成的 html 譬如是:<form method="post" action="post.aspx" enctype="multipart/form-data">
    请选择上传文件:<br>
    <input name="thefile" type="file"><br> 
    <input name="上传" type="submit">
    </form>
    其实是 hmtl 标签 <input name="thefile" type="file"> 的作用, 浏览器负责上传文件,
    调用 http POST 命令, 后台向 web 服务器发送的 socket 请求为:
    [code=BatchFile]
    POST /post.aspx HTTP/1.0
    Referer: http://hypothetical.ora.com/clinton/upload.html
    Connection: Keep-Alive
    User-Agent: Mozilla/3.01Gold (WinNT; U)
    Host: hypothetical.ora.com
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
    Content-type: multipart/form-data; boundary=--
    -------------------------11512135131576
    Content-Length: 313-----------------------------11512135131576
    Content-Disposition: form-data; name="done"Submit Query
    -----------------------------11512135131576
    Content-Disposition: form-data; name="thefile"; filename="c:\temp\hi.txt"
    Content-Type: text/plainhi there-----------------------------11512135131576--
    [/code]你分析一下 html 和这个请求片断, 就可以自己用 socket 来做了.
      

  3.   

    asp.net是http通讯,和socket通讯是两回事。你说到socket上传只能靠C/S程序实现,或者要让客户端装一个ActiveX控件。
      

  4.   


    http 不用 socket 么, 你真搞笑