ios 可以直接上传大文件而不用分割么?
PHP中文网
PHP中文网 2017-04-18 09:41:33
0
2
657

通过七牛上传视频,本来没考虑太多,认为直接上传文件就可以,但是通过别人提醒说,手机上传过大文件的话,是不是需要分割一下,比如说一个两个G的视频,再宽带允许的情况下,手机资源会不会被占满?还是说,直接就可以通这个方法

-(void)putData:(NSData *)data
        key:(NSString *)key
      token:(NSString *)token
   complete:(QNUpCompletionHandler)completionHandler
     option:(QNUploadOption *)option ;

而不用去分割,因为系统,或者api已经处理过了?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
伊谢尔伦

In my humble opinion, if I’m wrong, just think I’m talking nonsense:
Your data is in the memory, so the memory will either give you a warning or it will crash directly

http://stackoverflow.com/ques...
iOS memory allocation - how much memory can be used in an application?

伊谢尔伦

Large files are uploaded through file streams. Do not use data. Data is stored in memory, which may not be enough for large files.

Large file uploads generally use breakpoint resumption instead of "split files". The general meaning is that each time a bit of data is read from the file and then uploaded, after the upload is successful, the subsection is marked. Next time, data of a certain length will be taken from this subsection and uploaded again. If the network is disconnected or an error occurs in the middle, it doesn't matter. The next upload will still start from this subsection, which is similar to the "breakpoint download" principle of downloading files, but requires a little work on the server side.

Qiniu’s SDK has implemented breakpoint resumption, so you don’t have to worry about anything. There is not much difference in the usage of system resources between transferring 1TB and transferring 1KB.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!