5 Replies Latest reply on Jun 17, 2015 7:39 AM by Dave Miller

    How do I accept file upload through rest api


      I am attempting to implement a REST endpoint that accepts a multi-part form request that includes form data as well as a file upload. Is that even possible? Is it possible to just accept a file upload and nothing else (e.g. specify a unique ID in the URL and POST/PUT data in the request body)? I've tried numerous things and have been unable to successfully implement a REST endpoint that accepts a file upload...


      • Specify a CFARGUMENT type="binary" to the CFFUNCTION that is the REST endpoint definition. This results in a CF REST API compile error.
      • Submit a multipart/form-data POST/PUT request and use CFFILE to handle the file upload in the body of the CFFUNCTION. This causes the CF REST framework to not see any of the form-field parameters that are required by CFARGUMENT tags.
      • Uploading the file to a separate endpoint that expects only the file and setting the HTTP content-type header to the file's MIME type. The CF REST framework rejects this because it wants a specific content-type (presumably multipart/form-data or application/x-www-form-urlencoded).