Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

attach file in textarea

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello e.b.

Does anybody know if there's a way to attach the content of a textfile into a <textarea> , using the small browsing window you get when you use <input type=&quot;file&quot;>, so that it can be editted in this textarea an be sent to the next page where a cfmail action will do the rest?

Thanks!!!
 
Wow, what are you trying to do? Are you sure you are not making things too complicated for both yourself and your poor CF- and webserver ;-) ?
Let me get this straight: you want to be able to select a textfile from your local machine with input type=file, have the content of that file to be shown within a textarea, and then send it to the next page. Well, I won't judge this approach, but this should be something like it:

1. Make a form with input type=file and send it to a page called save.cfm or something. make sure the enctype of the form is multipart/form-data.
2. In save.cfm, upload the file to your webserver:
<cffile action=&quot;UPLOAD&quot; filefield=&quot;#FileFromForm&quot; destination=&quot;C:\inetpub\
3. Go to another page called show.cfm, and read the file:
<cffile action=&quot;READ&quot; file=&quot;C:\inetpub\ variable=&quot;content&quot;>

4. Show the file that was read in ten textarea:

<textarea name=&quot;MyContent&quot; cols=&quot;80&quot; rows=&quot;10&quot;><cfoutput>#content#</cfoutput></textarea>

There you go, hope this helps...


<webguru>iqof188</webguru>
 
It actually did help. Thanx a lot. That &quot;cffile action = read&quot; thing was basicly what i was looking for. I agree though, that it is a bit too complicated. I'll try something else first. tnx anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top