Splicing Upload file data

Source: Internet
Author: User

Learn to splice and upload file data .

{

* Some servers can submit some text content to the server while uploading files.

* Typical applications :

<1> sina Weibo : upload images at the same time , send a Weibo message !

<2> Shopping Review : when you buy a product, post a comment with a picture + comment content !

data format for multiple file uploads 3

{

Content-type:multipart/form-data; Boundary=boundary

//------The following, is the binary data format provided to the server

--boundary\r\n

Content-disposition:form-data; Name= "userfile[]", filename="Aaa.txt"\ r \ n

content-type:application/octet-stream\r\n\r\n

File binary Data

\ r \ n

--boundary\r\n

Content-disposition:form-data; Name= "userfile[]"; filename="AAA copy. txt"\ r \ n

content-type:application/octet-stream\r\n\r\n

File binary Data

\ r \ n

--boundary\r\n

//Username is the name of the script File receive parameter

Content-disposition:form-data; Name="username"\r\n\r\n

Plain Text binary data

\ r \ n

--boundary--

// ------

The above section is the constituent format of the binary data sent to the server ( example )

}

if in iOS , to implement POST upload file , need to follow the above format , splicing data !

because : format is the standard format specified by the company, Apple does not do any encapsulation ! Other languages , have done the encapsulation !

the above three kinds of data splicing format , we need to understand and can be splicing one of their own !

" third-party frameworks do file uploads :

-AFN can upload "a file" at the same time, Some format files , with AFN cannot upload !

-ASI can upload multiple files at the same time, MRC , stopped updating , designed target platform , IOS 2.0/ios 3.0 !

}

Splicing Upload file data

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.