2 Replies Latest reply on Jan 9, 2007 3:20 PM by MikerRoo

    loading url variables from file in CF ?

      Is it possible to load url formatted variables from a text file and have them read in natively in CF, kind of like of loadvaraibles() does in flash ?, the reason i ask is because i have a app that reads in data in flash but later on in the process i want a cf page to share the same variable data flash read earlier.

      I know CFFile would the read the entire contents in 1 variables but is there a way to read the variables in and have them readily available or is the only way to parse the single variable from the CFFile read. If so what the best way to parse and evaluate the data when in url format and read from a file e.g.


      any help here would be appreciated.

        • 1. loading url variables from file in CF ?
          insuractive Level 3
          I would use the ColdFusion list functions to parse out the information:

          1) Read your text file using <cffile>
          2) Treat your variables as a "&" delimited list (each list item is a name/value pair) and loop over each list item
          3) Extract your variable name/values using ListFirst() and ListLast() (using the "=" as a delimiter)
          4) Set CF variables (possibly in a structure for easy referencing) based on your extracted name/value pairs.

          Put it all in a CFC or a custom tag and you have yourself a quick ColdFusion URL2Struct tool.
          • 2. Re: loading url variables from file in CF ?
            MikerRoo Level 1
            Save and read the URL structure in WDDX format (look it up in the CF docs).