解决方案 »

  1.   

    前一段时间在看微信上传文件,其中一种方式就是模拟form表单提交多媒体文件,要定义表头啊等等一堆东西,而文件本身也要读的,读的方法用的字节流。所以了,你的同事的这个方法其实是可以的了。
      

  2.   

    你说的模拟form提交。。认为设定contentType之类的,我说的这个是直接上传并且存二进制!就如我举的那个json的例子,这还叫上传吗。。
      

  3.   

    不是不行。
    json 处理 10 MB 以上的数据明显有性能问题。
    你按照他的想法写一个 json 处理,文件 20MB,看看会有什么情况。
      

  4.   

    还是斑斑机智啊。。做客户端的一点都不了解web的,想怎么做就怎么做,现在烦死了
      

  5.   

    一般小的 图片 都可以 用二进制放 数据库的 lob字段里面。但是不建议这么做。
      

  6.   

    这样做不是很正常吗,你在接口里面把json内容处理一下,再把2进制文件内容封装一下,加个头文件内容(类似Content-Type: application/octet-stream\r\n\r\n),不是可以上传吗
      

  7.   

    理论可行,很小的文件可以。
    大一点的文件,二进制码,1位变8位,直接size*8。那么传输时间*8。原本需要5秒,现在变40秒。一秒也变8秒。用户体验需要考虑。
      

  8.   


    but he can take the json content and build multipart/form-data on his own or just simply take advantage of any javascript library, such as jquery. So he can have a ajax-based upload...
      

  9.   


    who told you that? binary-to-text encoding is so common, such as radix-64, aka base64. With base64, even counting padding,  the encoded string is only about137% of the original data length...
      

  10.   


    but he can take the json content and build multipart/form-data on his own or just simply take advantage of any javascript library, such as jquery. So he can have a ajax-based upload..."filecontent":"这里放文件的二进制码",不瞎应该能看到这块吧。
      

  11.   

    Did u piss off, asshole?U dummy ass doesn't have brain, do u?If u are not blind, u should see attribute filecontent has a type of string! Show us how u gonna store binary in string format without proper encoding, fucking idiot!U were born in 1979, u are supposed to be a matured man not a pushy. Unfortunately, u are not even close to the latter!Eat my shit, asshole!but he can take the json content and build multipart/form-data on his own or just simply take advantage of any javascript library, such as jquery. So he can have a ajax-based upload..."filecontent":"这里放文件的二进制码",不瞎应该能看到这块吧。
      

  12.   

    上面说可以上传的,我只想问你们一句,TMD怎么在浏览器里面获得存放在磁盘上的文件的二进制流?你他妈的玩我?求你们把JS代码贴给我,HTML也可以,我去。
    TMD js有TMD流控制组件么?还是Html有流控制组件?
      

  13.   


    哪里说了用js从硬盘上文件的二进制流...楼主给的条件是已经有了包含二进制码的json...
      

  14.   

    json里面已经包含了文件的二进制码,文件名也有,那么理论上可以实现额
      

  15.   


    好像楼主都没有说过数据是从页面来的,web的接口一定要从页面来吗,不懂
      

  16.   


    好像楼主都没有说过数据是从页面来的,web的接口一定要从页面来吗,不懂