Network Programming for iOS development-using NSURLConnection for file upload and iosnsurlconnection
Using NSURLConnection to upload files is cumbersome.
This document does not introduce the use of third-party frameworks to upload files.
Body:
Here we first provide the interface for encoding testing: http: // 120.25.226.186: 32812 click in and you will find the following:
It is best to use the Google browser to open the link, because it is easier to use the Google browser to enable the developer mode.
Then you can select an image and Click upload. The link is changed to http: // 120.25.226.186: 32812/upload. This link is used to encode the uploaded file.
The request information presented by the browser can obtain the request header information and request body information, which is required for the upload file encoding.
Code display:
Test:
Source code Baidu cloud sharing link: http://pan.baidu.com/s/1dEhsH81 password: 8qrm
Reprinted with the source: Network Programming for iOS development-use NSURLConnection to upload files and respect the fruits of labor.