HttpParam File Values

Several of the API’s we have to use require us to make http requests where we have to take files, convert them from binary to base 64, and embed them in JSON documents. The size of these files are typically arbitrary. In certain situations the files are large enough that we can run into memory issues.

I’ve looked into java libraries that allow streaming with http requests, and while I know it is technically the proper way to do this, it also drastically complicates making requests, and I would rather avoid if I can; I really do like how simple lucee makes it to make http requests.

The idea I had though would be if httpparam allowed us to use the file attribute for passing the value of the parameter. I could then generate the json as a file (which while still not ideal is much simpler) and then just pass the filename to the attribute.

So at the moment with the file attribute it works like this:

<cfhttpparam type="file" name="fileUpload" file="temp.txt">

It would generate a multipart http request, and pass the contents of the file, the filename, and the formfield name; so typical file upload.

I’d like to be able to do this:

<cfhttpparam type="body" file="temp.txt">

Instead of supplying a value attribute, we give it a file name, and the contents of the file would be read and used for that parameter instead.

If there’s no good reason not to, I think that the cfhttpparam types XML & form/formField should support this too (at bare minimum I’d like it for the body type).

Open to any criticisms or suggestions.