|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
ColdFusion newbie trying to write to a txt file
Author: Kurt Dommermuth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161597
More follow up since there really isn't all that much info out there
regarding flash passing variables to Coldfusion to text files.
here's the coldfusion script in a file called "write_text_file.cfm":
<cfset the_path = ExpandPath("*.*")>
<cfset this_directory = GetDirectoryFromPath(the_path)>
<cffile action="write" file="#this_directory#\YOUR_TEXTFILE"
output="#YOUR_VARIABLE#">
and here's the flash button action.
on (release, keyPress "<Enter>") {
YOUR_VARIABLE = escape(YOUR_VARIABLE);
loadVariables("write_text_file.cfm","","get");
content = "";
}
Thanks all,
Kurt Dommermuth
At 11:06 AM 4/28/2004 -0400, you wrote:
----- Excess quoted text cut - see Original Post for more -----
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Dave Francis
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161589
Have you coded NAMECONFLICT="OVERWRITE" ? Also check the values
file.fileExisted and file.fileWasOverwritten
If cffile was sandboxed, cf would blow with an error saying so.
-adam
>
> is this a shared hosting environment? is cffile allowed?
>
> tony
>
> Adam, had also asked if I was getting errors and I forgot to say that I
> wasn't.
>
> Tony, I used <cfoutput>#GetBaseTemplatePath()#</cfoutput> to
determine
where
> exactly I was in the directory structure and used this information as an
> absolute path. still no luck.
>
> this is what it looked like when I tried that.
>
> <cffile action = "write" file =
> "D:\http\centurycouncil_org\kurt_test\write_greeting.cfm" output =
"test">
>
>
> thank you,
> Kurt
>
>
>
>
> At 09:20 AM 4/28/2004 -0400, you wrote:
> >you may need to use the full path like
> >
> >c:\inetpub\wwwroot > >
> >or it will likely throw the newly created file into some system
directory
> or
> >root path of something.
> >
> >are you getting errors? or are you just not getting the file in the
place
> >you are expecting?
> >
> >tony
> >
> >
> >Hi,
> >
> >I was hoping someone could help. I am trying to do something and have
> tried
> >a ton of variations, but have had no luck.
> >
> >why won't this write to a text file?
> >
> ><cffile action = "write" file = "write_greeting.cfm" output =
"test">
> >
> >thanks for any help,
> >Kurt
> >
> >Kurt Dommermuth
> >Head Woodsman: http://www.punch-me.com
> >Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Adrocknaphobia
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161588
Kurt,
Well, you have options out the ying-yang between Flash and CF. If you are running
CFMX you easiest solution would be to implement Flash Remoting. It's all of about
5 lines of Flash code to make calls directly to CF.
Another options is an XML based webservice.
Finally you can also just pass values to a plain old CF page through the URL.
-adam
----- Excess quoted text cut - see Original Post for more -----
Author: Kurt Dommermuth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161585
Just a follow-up. the guy who normally does CF gave me this as a solution.
<cfset the_path = ExpandPath("*.*")>
<cfset this_directory = GetDirectoryFromPath(the_path)>
<cffile action="write" file="#this_directory#\ccText.txt"
output="centurycouncilmessage=test">
this works.
but now, what I really want to do, and this is probably OT, but I hope you
don't mind me asking anyway, is pass a variable called 'content' from flash
to the above script with the exception that
output="centurycouncilmessage=test" would really be
output="centurycouncilmessag=#content#".
anyone, using flash to talk to Cold fusion>?
thanks again (and again!)
Kurt
At 02:49 PM 4/28/2004 +0000, you wrote:
----- Excess quoted text cut - see Original Post for more -----
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Adrocknaphobia
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161581
If cffile was sandboxed, cf would blow with an error saying so.
-adam
----- Excess quoted text cut - see Original Post for more -----
Author: Kurt Dommermuth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161574
Hi Stephen,
>I would have expected a permission denied error if this was the case.
no. I didn't get any permission denied errors.
>Are you sure that the file isn't being written?
yes.
> It might be a problem
>with flash reading the file rather than the file not being created.
No. this works well and I understand why you'd mention it, but I'm pretty
experienced with flash.
>Incidently, you do realise that every user will see the same message?
>If this is what you're after, then an easier way would just be to set a
>CF variable to the message (URLEncodedFormat) and pass it directly into
>the flash using object/embed parameters. No file writing involved -
>much more efficient.
The message is for the client to write to the user. It is meant to be seen
by everyone, but it is also something that she can update as needed without
having to deal with any internet innards.... just a flash interface.
Thank you!
Kurt
----- Excess quoted text cut - see Original Post for more -----
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Stephen Moretti
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161572
Tony Weeg wrote:
----- Excess quoted text cut - see Original Post for more -----
I would have expected a permission denied error if this was the case.
Are you sure that the file isn't being written? It might be a problem
with flash reading the file rather than the file not being created.
Incidently, you do realise that every user will see the same message?
If this is what you're after, then an easier way would just be to set a
CF variable to the message (URLEncodedFormat) and pass it directly into
the flash using object/embed parameters. No file writing involved -
much more efficient.
Stephen
CFMX Hosting
::Macromedia ColdfusionMX hosting, with support for FlashMX, Flash Remoting,
DreamweaverMX::
www.CFMXHosting.co.uk
Author: Tony Weeg
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161568
possiblemente...
At 09:37 AM 4/28/2004 -0400, you wrote:
>is this a shared hosting environment? is cffile allowed?
>
>tony
hmmmmmm. good question.
I suppose I have to contact the admin to find out?
----- Excess quoted text cut - see Original Post for more -----
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Kurt Dommermuth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161567
At 09:37 AM 4/28/2004 -0400, you wrote:
>is this a shared hosting environment? is cffile allowed?
>
>tony
hmmmmmm. good question.
I suppose I have to contact the admin to find out?
----- Excess quoted text cut - see Original Post for more -----
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Tony Weeg
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161565
is this a shared hosting environment? is cffile allowed?
tony
Adam, had also asked if I was getting errors and I forgot to say that I
wasn't.
Tony, I used <cfoutput>#GetBaseTemplatePath()#</cfoutput> to
determine where
exactly I was in the directory structure and used this information as an
absolute path. still no luck.
this is what it looked like when I tried that.
<cffile action = "write" file =
"D:\http\centurycouncil_org\kurt_test\write_greeting.cfm" output = "test">
thank you,
Kurt
At 09:20 AM 4/28/2004 -0400, you wrote:
>you may need to use the full path like
>
>c:\inetpub\wwwroot>
>or it will likely throw the newly created file into some system directory
or
----- Excess quoted text cut - see Original Post for more -----
tried
----- Excess quoted text cut - see Original Post for more -----
Fast
>Unsubscribe] [<http://www.houseoffusion.com/signin/>User
Settings]
>
>----------
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Kurt Dommermuth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161563
Adam, had also asked if I was getting errors and I forgot to say that I wasn't.
Tony, I used <cfoutput>#GetBaseTemplatePath()#</cfoutput> to
determine
where exactly I was in the directory structure and used this information as
an absolute path. still no luck.
this is what it looked like when I tried that.
<cffile action = "write" file =
"D:\http\centurycouncil_org\kurt_test\write_greeting.cfm" output = "test">
thank you,
Kurt
At 09:20 AM 4/28/2004 -0400, you wrote:
----- Excess quoted text cut - see Original Post for more -----
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Kurt Dommermuth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161562
Hi Adam,
The only code in my (write_greeting.cfm) test file is this...
<cffile action = "write" file = "ccText.txt" output = "test">
(apologies, i put the wrong parameter in 'file' in my last email.)
I have a little flash movie that loads in dynamic text from the file
ccText.txt.
I also have a little flash interface so my client can:
- enter a greeting and change the contents of ccText.txt.
I am using CF because it's just whats installed on this particular server
(normally I'd use PHP!).
Hope I'm clear!?
thansk again
At 01:19 PM 4/28/2004 +0000, you wrote:
----- Excess quoted text cut - see Original Post for more -----
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Stephen Moretti
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161560
Kurt Dommermuth wrote:
----- Excess quoted text cut - see Original Post for more -----
It should write the file write_greeting.cfm into the current template
folder with the content "test".
Whats the error message you are getting?
What are you actually trying to do by writing a cfm file?
Stephen
CFMX Hosting
::Macromedia ColdfusionMX hosting, with support for FlashMX, Flash Remoting,
DreamweaverMX::
www.CFMXHosting.co.uk
Author: Tony Weeg
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161559
you may need to use the full path like
c:\inetpub\wwwroot
or it will likely throw the newly created file into some system directory or
root path of something.
are you getting errors? or are you just not getting the file in the place
you are expecting?
tony
Hi,
I was hoping someone could help. I am trying to do something and have tried
a ton of variations, but have had no luck.
why won't this write to a text file?
<cffile action = "write" file = "write_greeting.cfm" output = "test">
thanks for any help,
Kurt
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
Author: Adrocknaphobia
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161558
Could you show us the full code, and exactly what isn't working about it. Are you
getting unplanned results or is cf throwing an error?
Why are you trying to create a cfm?
-adam
----- Excess quoted text cut - see Original Post for more -----
Author: Kurt Dommermuth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32193#161557
Hi,
I was hoping someone could help. I am trying to do something and have
tried a ton of variations, but have had no luck.
why won't this write to a text file?
<cffile action = "write" file = "write_greeting.cfm" output = "test">
thanks for any help,
Kurt
Kurt Dommermuth
Head Woodsman: http://www.punch-me.com
Something fun for the itty bitty ones: http://www.kneebouncers.com
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||