ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #16  
Old May 18th, 2004, 03:04 PM
sunbigsmile sunbigsmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 27 sunbigsmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes,
Here is the page outline.
The first page name insert.cfm
<cfform action="insert_processing.cfm" method="post" enctype="multipart/form-data">
username <cfinput type="text" name="username">
image <cfoutput><input type="file" name="image"></cfoutput>
------The reason I used cfoutput is so that there is no error message later on in the next page---
<input type="submit" value="insert">
</cfform>

The next page: insert_processing.cfm
<cfquery datasource="datasource_name">
insert into user
values(#form.username#, #form.image#)
</cfquery>
<cfquery datasource="datasource_name" name="show">
select *
from user
where userid = #form.userid#
</cfquery>

<cfoutput query="show">#username#</cfoutput>
Your photo:&nbsp;
<cfif isdefined("form.image") and form.image is not "">
<cffile action="upload"
destination="path of server_folder"
fileField="form.image">

<cfoutput>
You uploaded #cffile.ClientFileName#.#cffile.ClientFileExt#
successfully to #cffile.ServerDirectory#.
</cfoutput>
<cfquery name="getimage_name" datasource="datasource_name">
SELECT image FROM user WHERE userid = #form.userid#
</cfquery>
Here is your image
<img src="images/#getimage_name.image#">

<cfelse>&nbsp;</cfif><br>

That is it. Please let me know where I got wrong. Thanks so much for helping me!!!

Reply With Quote
  #17  
Old May 18th, 2004, 03:20 PM
bfolger71 bfolger71 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Boston, MA
Posts: 47 bfolger71 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 34 sec
Reputation Power: 5
Hi Sun -

OK, here's a few things I see... however, I can't tell if this is the real code from your page, or if you've abridged for the sake of the post:

<cfquery datasource="datasource_name">
insert into user
values(#form.username#, #form.image#)
</cfquery>

is not a valid query. As far as I know, you *always* need to specify which fieldname you are inserting to. Also, you need single quotes around string values.

Next, where is FORM.userid being set? I don't see an input on the insert.cfm, hidden or otherwise, and you reference it in two separate places on the processing page.

Also,

<cffile action="upload"
destination="path of server_folder"
fileField="form.image">

The destination parameter here needs to be a valid absolute path... Is this just placeholder text for the sake of this post?

Next,

<cfoutput>
You uploaded #cffile.ClientFileName#.#cffile.ClientFileExt#
successfully to #cffile.ServerDirectory#.
</cfoutput>

Is the above output correct when you run the page?

Finally, are you getting any errors when you run the page?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > open window to select a picture file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway