Forge.ajax files


#1

Hi,

I was wonder if there was any extended documentation on the forge.ajax for files. When I attempt to send this over I don’t see the header info for file, or I should say when it gets to the server and I try and access say the form or argument of file it does not seem to be there so I was curious if there was an example or maybe what the file attribute is sent over as?


#2

Files are uploladed using the standard form encoding by default. (i.e. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file)

You can also do a raw upload where the request body contains the data for the file:

forge.request.ajax({
  type: 'POST',
  url: 'http://my.server.com/upload_image/',
  fileUploadMethod: "raw",
  success: function(data) {
    alert('Uploaded image');
  }
});

Also see: https://trigger.io/modules/request/current/docs/index.html

…and lots of examples here:


#3

Ok, I got this working now…

Thanks!