Charlie, I'm facepalming myself because I never even thought of getTempDirectory() - it just wasn't on my radar. I'll give that a shot. I have a good feeling that it will work. Thank you for the suggestion, and I will check your blog entry when I have a chance.
charlie@carehart.org wrote First, even if you could do what you want, wouldn't your "Readbinary" of the file be "another bunch of disk io" (the read of it, to memory)? |
Unless I misunderstand the process, form pushes binary to web server which saves to tmp directory (one write). From this point, if I use "readbinary", that's a read from the disk that stores the binary into a variable/file object (one read). As far as deleting the file, which is automatic, there is only one minor thing that happens - the file isn't actually deleted, the filename is changed so that the first character of the filename becomes a question mark (?) so that it is invisible to the table of contents and can be overwritten by the OS at any time. Using CFFILE action="upload", the file is written to tmp, read from tmp, written to destination, then read from destination for processing. Two writes, two reads, on a system where the tmp folder is not on the same partition as the webroot. Even with the faster disk drives, even SDD, the difference is marginal, yes. But I'm that OCD about certain things. And there is something else involved that I am not at liberty to discuss. 
charlie@carehart.org wrote And then what would you be doing, with that file once in memory? Writing it somewhere? Wouldn't your write to that "new location" be another set of disk io? |
As of this writing, the file will be attached to an email and sent to an organization inbox. The future, however, involves inserting the file into a database as part of a custom built processing application that will allow authorized users to browse and search the data.
charlie@carehart.org wrote Or might this be a case that in your need to be clandestine :-), you're not REALLY describing the actual situation? But instead you're using terms and concepts that you think would present a scenario where your need for what you request would seem "reasonable" to anyone looking? |
I think clandestine could apply, yes.
When you work for the DoD, you can't always reveal all details. So I have to get creative, sometimes, in order to express a concept or situation.
V/r,
^ _ ^
I am gobsmacked.
As I was playing around with getTempDirectory(), it just flashed in my mind: form is a struct. The following code does precisely what I want to do, is WAY more simple than I thought I was going to need, and.. and.. smh
<cfswitch expression="#StructKeyExists(form,'fileField')#">
<cfcase value="yes">
<cffile action="readbinary" file="#StructFind(form,'fileField')#" variable="thisFile" />
<cfdump var="#variables.thisFile#" />
</cfcase>
</cfswitch>
This code displays a (truncated) binary code in string format. Correction: This code displays a binary code in string format, but the string is truncated. Now I have the file object that I need to insert into an email and push to the mail server. And it was so simple! 
V/r,
^ _ ^