Guest User

Untitled

a guest
Sep 2nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. xhr.open('POST',(Ti.App.Properties.getString("apiaddress") + '/expense_service/add_expense'));
  2. //Try setting header 1.6.0
  3. xhr.setRequestHeader("Content-Type","multipart/form-data");
  4. xhr.setTimeout(0); //test apparently this will set it so it never times out?
  5.  
  6. ///Test w/ destFile instead of theImage
  7. var resultFile = Titanium.Filesystem.createTempFile();
  8.  
  9. var resultImageView = Titanium.UI.createImageView({
  10. image:theImage,
  11. top:0,
  12. left:0,
  13. height:360,
  14. width:240
  15. });
  16.  
  17. resultFile.write(resultImageView.toBlob());
  18.  
  19. xhr.send({
  20. media:resultFile,
  21. username:Titanium.App.Properties.getString("un"),
  22. password:Titanium.App.Properties.getString("pw"),
  23. amount:amtfield,
  24. date:dateField.value,
  25. category:parseInt(categoryID),
  26. merchant:merchantField.value,
  27. client:parseInt(clientID),
  28. payment_type_id:parseInt(payID),
  29. source:Titanium.Platform.name + Titanium.Platform.osname + Titanium.Platform.ostype + Titanium.Platform.version,
  30. location:geoLocation,
  31. mileage:mileageamt,
  32. notes:notesField.value,
  33. creation_time_in_milli_secs:uniqueid
  34. });
Add Comment
Please, Sign In to add comment