Advertisement
KiberInfinity

XFR2 form

Jul 28th, 2015
218
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         var formBuilder = new FormBuilder();
  2.         blob = UserAPI.utils.dataURItoUint8Array( file );
  3.         formBuilder.addFile( 'photo', blob );
  4.  
  5.         XFR2.send( {
  6.             url    : url,
  7.             method : 'POST',
  8.             headers: {
  9.                 'Content-type': 'multipart/form-data; boundary=' + formBuilder.BOUND
  10.             },
  11.             data   : formBuilder.getArray()
  12.         }, function ( res ) {
  13.             if ( res.error ) return cb( res.error );
  14.             var photo = UserAPI._parsePhotoHash( res.text );
  15.             cb( null, photo );
  16.         } );
Advertisement
RAW Paste Data Copied
Advertisement