all groups > coldfusion flash integration > september 2006 >
You're in the

coldfusion flash integration

group:

Uploading image


Uploading image infa
9/12/2006 12:00:00 AM
coldfusion flash integration:
I'm got a cool uploading images tutorial from Asfusion.com. I got it working
but this is my issue. I created a db table called "photos", in the photos
table I made two columns named "id" and "images". I'm allowing users to login
and upload images to a folder on my server. I now want to save the name of the
image that was uploaded, to my db column named "images" aswell as save the user
id to my "id" column. I'm using SESSION.Auth.id .

I'm using a tabbed cfform to do this, what I'm trying to make happen is on one
tab is the upload field and upload button, on the second tab I want to bind the
images that was upload by a specifc user (called by the id) to a cfgrid and
display all the images uploaded by that user. So I want to associate all the
images of a specific user to there user id.

How do I send the users id through the query string to get saved to my db
table called photos?

If my code is incorrect, can someone lead me in the right direction? Or is
there an easier way to get what I nreed to get done?

Thanks
Rob


This is the upload code:

<cf_flashUpload label="Picture:" name="myfile2" fileTypes="*.jpg;*.png;*.gif"
fileDescription="Image files" actionFile="upload.cfm" maxSize="500">


<cf_flashUploadInput buttonStyle="corner-radius: 10;"
inputStyle="fontWeight:bold" inputWidth="190" uploadButton="true"
uploadButtonLabel="Upload" chooseButtonLabel="Choose file" progressBar="true"
progressInfo="true" required="yes" message="Please enter a valid file to
upload!" />
</cf_flashUpload>

This is the processing script:

<cfif structkeyexists(form,"Filedata")>
<cffile action="UPLOAD" filefield="FileData"
destination="#expandpath("\uploads")#" nameconflict="MAKEUNIQUE">
</cfif>


<CFQUERY DATASOURCE="#DataSource#">
INSERT into photos(images,id)
VALUES('#Trim(FORM.myfile2)#',
('#Trim(URL.SESSION.Auth.id)#')
</CFQUERY>

Re: Uploading image Rick
9/12/2006 10:10:42 PM
Add a cfinput to your for name it whatever your db field is and use
SESSION.Auth.id vaerable as the value. Then pass this over to the cfc via
the remoting and insert it into your db.

[quoted text, click to view]

Re: Uploading image infa
9/15/2006 5:50:34 AM
Ok, I'm new to cf so if I understand you, this is what I should do:

<cfinput
type="Text"
name="myimages" (This is the name of my image table)
value="SESSION.Auth.id"
size="20"
maxlength="100">

Now from here, do I ad this field above my upload field?
And does the user enter their id into this field before they uploading?

Could you perhaps write an example code of passing the value to the cfc.
Again I'm new to cf, I understand what they are and how they work thanks ot Ben
Forta's book, but I have not yet try to make one. this is the part of you
message that has me puzzled:

"Then pass this over to the cfc via
the remoting and insert it into your db."

Thanks a lot Rick for your help.

Rob.
AddThis Social Bookmark Button