1.1.0 • Published 8 years ago

projectzerorn-fileupload v1.1.0

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

projectzerorn-fileupload NPM version

Installation

npm install projectzerorn-fileupload --save
rnpm link react-native-file-uploader

Usage

All you need is to export module import {FileUpload} from 'NativeModules'; and direct invoke FileUpload.upload.

		import {FileUpload} from 'NativeModules';

		var obj = {
            uploadUrl: 'http://file.testapi.dev.ipo.com/file/upload/',
            headers: {
                'referer': 'http://www.fangjiadp.com',
            },
            fields: {
                'file': 'file',
            },
            files: [
                {
                    filepath: '/sdcard/1.png',  //android文件支持: 1.content: 2.file: 3.绝对路径
                                                //iOS文件待测试 支持: 1.assets-library:  2.data:  3.file: 4.绝对路径
                },
            ]
        };
        
        FileUpload.upload(obj, (err, result)=> {
            console.log('upload:', err, result);
		})

License

MIT