hey everyone, I am having trouble with a custom on...
# general
f
hey everyone, I am having trouble with a custom online HTML form that i am working on for a custom record. I need to attach a few files to the custom record via file attachment fields on the online form. I am having trouble sending the file contents to the suitelet I have created which is responsible for taking the file contents, and uploading it into the file cabinet. Where I am struggling is really with the HTTP post request on my online form to take the contents from the file attachment fields and send the data to the suitelet. This is what i have so far in terms of the post request:
Copy code
var data = new FormData();
$.each( $( '.file' )[ 0 ].files, function( i, file ) {
  console.log( file );
  data.append( 'file-' + i, file );
} );
console.log( data );
$.ajax( {
  url: postURL,
  data: data,
  cache: false,
  contentType: false,
  processData: false,
  method: 'POST',
  type: 'POST', // For jQuery < 1.9
  success: function( data ) {
    alert( data );
  }
however, the body of the request in the suitelet is empty. any help is greatly appreciated!!
r
Try logging context or context.request And see if anything related to the data you posted is there. try posting simple text too, to find if its a case of data type.