Latest 1.0.1
Homepage https://github.com/QianChia/QFormData
License MIT
Platforms ios 7.0, requires ARC
Authors

Logo

  • A simple encapsulation of upload file data.

GitHub:QianChia | Blog:QianChia(Chinese)


Installation

From CocoaPods

  • pod 'QFormData'

Manually

  • Drag all source files under floder QFormData to your project.
  • Import the main header file:#import "QFormData.h"

Examples

  • Single File Upload

    
        #define boundary @"uploadBoundary"
    
        NSMutableData *formDataM = [NSMutableData data];
    
        [formDataM q_setHttpHeaderFieldWithRequest:request fileBoundary:boundary];
    
        [formDataM q_appendPartWithFileURL:fileURL fileBoundary:boundary name:@"userfile" fileName:@"test1.png" mimeType:@"image/png"];
    
        [formDataM q_appendPartWithText:@"qian" textName:@"username" fileBoundary:boundary];
    
        [formDataM q_appendPartEndingWithFileBoundary:boundary];
    
  • OR

    
        NSData *formData = [NSData q_formDataWithRequest:request text:@"qian" textName:@"username" fileData:filedata name:@"userfile" fileName:@"test2.png" mimeType:@"image/png"];
    
  • Multiple File Upload

    
        NSData *formData = [NSData q_formDataWithRequest:request texts:@[@"qian"] textNames:@[@"username"] fileURLs:@[fileURL1, fileURL2] name:@"userfile[]" fileNames:@[@"demoFile1.png", @"demoFile2.jpg"] mimeTypes:@[@"image/png", @"image/jpeg"]];
    

Latest podspec

{
    "name": "QFormData",
    "version": "1.0.1",
    "platforms": {
        "ios": "7.0"
    },
    "license": "MIT",
    "homepage": "https://github.com/QianChia/QFormData",
    "authors": {
        "QianChia": "[email protected]"
    },
    "summary": "A simple encapsulation of upload file data",
    "source": {
        "git": "https://github.com/QianChia/QFormData.git",
        "tag": "1.0.1"
    },
    "source_files": "QFormData",
    "requires_arc": true
}

Pin It on Pinterest

Share This