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