File upload Download

Source: Internet
Author: User

Internet
File upload Download

Small file Download

If the file is small, the download method will be more

P directly with NSData's + (ID) Datawithcontentsofurl: (nsurl*) url;p use nsurlconnection to send an HTTP request to download p if it is a download picture, you can also use the Sdwebimage framework

An example of an HTTP range

You can specify the size of each packet to be downloaded from the network by setting the request header range

Range Example

bytes=0-499 from 0 to 499 of the first 500 bytes

bytes=500-999 from 500 to 999 of the second 500 bytes

bytes=500-All bytes since 500 bytes

Bytes=-500 last 500 bytes

bytes=500-599,800-899 specify several ranges at the same time

Range Summary

-Used to separate

The number in front of P represents the number of bytes from the starting byte p, which represents the cutoff byte, not the end

, for grouping, you can specify more than one range at a time, but rarely

Third party decompression Frame--ssziparchive

: https://github.com/samsoffes/ssziparchive

Note: The Libz.dylib framework needs to be introduced

Unzipping

NSString *zippath= @ "Path_to_your_zip_file";

NSString *destinationpath= @ "path_to_the_folder_where_you_want_it_unzipped";

[SSZipArchiveunzipFileAtPath:zipPathtoDestination:destinationPath];

Zipping

NSString *zippedpath= @ "path_where_you_want_the_file_created";

Nsarray *inputpaths= [Nsarray arraywithobjects:

[[NSBundle mainbundle]pathforresource:@ "photo1" oftype:@ "jpg"],

[[NSBundle mainbundle]pathforresource:@ "Photo2" oftype:@ "jpg"]

NIL];

[SSZipArchivecreateZipFileAtPath:zippedPathwithFilesAtPaths:inputPaths];

Multipart/form-data Format Summary

File upload Download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.