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!

Image as variables

Status
Not open for further replies.

ma701sd

IS-IT--Management
Dec 15, 2000
94
GB
Hi all,

I am creating a user directory dynamically when a user creates an account. The name of the directory is named as the username (so that its easy to keep track of the user)

WHat im trying to do is to upload a JPEG or GIF image file into the user's directory defined by the username i.e upload the file into the directory named #client.username# - This works fine,
However, on the action page I want to display the image but it does not seem to work i.e. the variable #imagesection1# is not displayed, instead it displays a temp directory as the value of the variable?

I hope this makes sense..

I have attached the code:

Uploading
<CFFORM ACTION=&quot;Viewsite.cfm?cfid=#cfid#&amp;cftoken=#cftoken#&quot; METHOD=&quot;POST&quot; ENCTYPE=&quot;MultiPart/Form-Data&quot;>
<B> Image for section 1 </b><BR>
<INPUT TYPE=&quot;File&quot; NAME=&quot;ImageSection1&quot;>
<BR>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;process&quot;>
<INPUT TYPE=&quot;reset&quot; VALUE=&quot;Clear&quot;>

The action page:

<CFFILE ACTION=&quot;Upload&quot;
FILEFIELD=&quot;ImageSection1&quot;
DESTINATION=&quot;c:\webshare\
<!--- this syntax directly below displays the full path to the directory, after #client.username# a temp directory is displayed i.e. c:\webshare\ --->
<CFOUTPUT>c:\webshare\
<!--- Displaying the image variable --->
<CFOUTPUT>
<IMG SRC= &quot;c:\webshare\</cfoutput>

I think CFFILE ACTION = &quot;ReadBinary&quot; might be the asnwer??

Is what I'm trying to do possible??

Many thanks and best regards

Sam
 
Hey Sam,

Try this:

<CFOUTPUT>
c:\webshare\</cfoutput>

The variable &quot;ImageSection1&quot; will contain the encoded file you are uploading and not just the name of the file. There is an entire list of Cffile variables available after a <cffile action=&quot;upload&quot;..> which you might want to check out in the manual. Cffile.serverfile contains the exact name of the file stored on the server which can be different than the original name if you use the &quot;makeunique&quot; option.

Good Luck
GJ
 
Hey GJ,

Thanks for the reply,
After I posted my problem, I did some further experimenting and was able to narrow down the problem (it was appending to the directory I specified). Along with the you suggestion, I modified it and purs like a pussy cat!!!!

Heres the modification :

<CFFILE ACTION=&quot;Upload&quot;
FILEFIELD=&quot;ImageSection1&quot;
DESTINATION=&quot;c:\webshare\NAMECONFLICT=&quot;Overwrite&quot;>

<CFOUTPUT>
<IMG SRC= &quot;../Project1/Users/#Client.UserName#/#cffile.serverFile#&quot;>


I have the book and did look at the variabls that were avaialable but I guess I needed a different perspective on it (and a fresh pair of eyes lol)

Thanks for your help

Much appreciated

Sam...


PS..CF fails to amaze...I detest programming but Im actually enjoying programming in CF!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top