Cffile upload and choosing form variables b4 upload
Even with tons of google searches I cannot figure this out:
I have a (CF) backend management system that identifies the user and the company they are with on login. These variables (and a couple of other identifyiers) are stored as session variables on the application page at login.
Certain users (depending on user level) can set up a company staff member and/or a client through regular cf html forms with action pages. These post to a SQL database.
Ultimately, part of what I'm trying to do is output an index of pdf forms that are either uploaded or generated dynamically. This index contains catagories and sub-catagories.
So... say, for example, when a company staff member is entered into the system, according to the user role this staff member is to be assigned -- I set up folders and sub-folders with cfdirectory (along with other database inserts).
Here's where my problem comes in:
I need to have the user set up an upload by selecting through dropdowns on a couple of form templates. These dropdowns set the (for example) StaffID that the upload is for and what catagory and subcatgory and other variables that are stored in the database - where the upload is to go etc...
I understand that a cffile upload will only "do the upload part" from the client and then you have to rename/move the file.
What I can't figure out is how to pass the variables from the preceding dropdown forms to the upload form and be able to use the variables for database inserts since the cffile enctype posts to itself. To me, this cgi post is like a page refresh, so, the form variables that are passed to the upload form are lost when you actually upload the file (posting to itself).
I'm trying to incorporate the "double upload" that I found on Ben Nadel's site that seems to resolve some security issues on uploads. (This "double upload" uploads the file to a temp directory where it runs checks on the upload and deletes it if all is not well and goes no further in the processing... If all is well it does the "real" upload to a different directory).
I can set up these two upload directories as 'session directories' on the application page at login...
But... I need the user (uploader) to be able to set up the "who" and "where" fields before the file itself is uploaded. A main point here is that if the upload doesn't meet the requirements before the upload takes place -- I don't need anything to be inserted into the database. (The database row created when the file is uploaded stores the StaffID, name of file, catagory, subcatagory, etc. and the index for retrieving these uploads will later be pulled from the database, which will point to where the uploads reside.)
Is this enough info to grasp what I'm trying to do? I know I can rename and move a file once uploaded but the upload info needs to be configured before the upload takes place and, not take place (no database insertion) if the upload doesn't meet the criteria, etc.
Thanks for anyone's input on this.
- ed
PS: I'm using CF9 and Not using anything like Flex or Ajax, JSON or JQuery... just straight CF
