>- see footer for list info -<
just a few comments and suggested amendments regarding your code.  also 
remember and put your CFML comments as <!--- instead of <!-- unless you 
want them to show up in the HTML source!

<!--- check file name has been entered --->
<!--- rewritten for brevity --->
<cfif NOT Len(form.file)>
 <cflocation url="change_add_pic.cfm">
</cfif>

<!--- get user details  --->
<!--- remember and lock session variables --->
<cflock scope="Session" type="ReadOnly" timeout="30">
 <cfquery name="Register" datasource="dating">
 SELECT *
 FROM dbo.Registered
 WHERE dbo.Registered.RegisterID = #session.registerID#
 </cfquery>
</cflock>

<!---  get the new photo --->
<!--- didn't need a cfoutput round this --->
<cffile accept="image/jpeg, image/jpg, image/pjpeg, image/gif"
action="upload" attributes="normal"
destination="C:\Apache2\htdocs\profiles\photos\" filefield="form.file"
nameconflict="makeunique">

<!--- removed unnecessary # # around variables --->
<cfset search_phrase= "#cffile.serverfile#">
<cfset text_length = Len(search_phrase)>
<cfset search_word= ArrayNew(1)>
<cfset temp = ArraySet (search_word, 1, 30, "")>
<cfset word=ArrayNew(1)>
<cfset wordcount = 1>
<cfloop index = "string_count" from = "1" to = #text_length# step = "1">
<cfif Mid(search_phrase, string_count, 1) is not " ">
<cfset search_word[wordcount] = search_word[wordcount] & 
Mid(search_phrase,
string_count, 1)>
<cfelseif Mid(search_phrase, string_count, 1) is " ">
</cfif>
</cfloop>
<cfset newfilename=search_word[1]>
<!--- got new photo name --->

<!--- compare files original name to one created above --->
<cfif search_word[1] is not cffile.serverfile>
<cffile action="rename" 
destination="#cffile.ServerDirectory#\#newfilename#"
source="#cffile.ServerDirectory#\#cffile.serverfile#">
</cfif>

<!--- update data with new photo name --->
<cfset thumbname = "thumb_#search_word[1]#">

<!--- lock here too --->
<cflock scope="Session" type="ReadOnly" timeout="30">
  <cfquery datasource="dating">
                 UPDATE Registered
                 SET Photo = '#search_word[1]#', PhotoThumb ='#thumbname#'
WHERE Registered.RegisterID = #session.registerID#
  </cfquery>
</cflock>

<!--- create new thumbs --->
<!--- don't need cfoutput here --->
<cfexecute name = "c:\Program Files\ImageMagick-6.0.1-Q16\convert.exe"
arguments = "-sample 200x200
\apache2\htdocs\profiles\photos\#search_word[1]#
\apache2\htdocs\profiles\photos\thumbs\#thumbname#"></cfexecute>
<cfexecute name = "c:\Program Files\ImageMagick-6.0.1-Q16\convert.exe"
arguments = "-sample 125x125
\apache2\htdocs\profiles\photos\#search_word[1]#
\apache2\htdocs\profiles\photos\thumbs\small\#thumbname#"></cfexecute>

<!-- set profile for admin review and return to View Profile -->
<cflocation url="profile_updated.cfm">




"Jenny" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
18/10/2004 08:51
Please respond to
Coldfusion Development <[EMAIL PROTECTED]>


To
"Matt Horn" <[EMAIL PROTECTED]>, "Coldfusion Development" 
<[EMAIL PROTECTED]>
cc

Subject
RE: [CF-Dev] cffile - pic uploads






>- see footer for list info -<
Hi Matt,

Thanks for your reply.

Yes i have .. been going through my code.  I have a routine to check for
blank spaces in the file names, i think it's after this routine is run and
the file is renamed without spaces that the problem might exist.   This is
my pic processing cfm.


<!-- check file name has been entered -->
<cfset found = 0>
<cfif #form.file# is not "">
<cfset found =1>
</cfif>
<cfif found is 0>
<cflocation url="change_add_pic.cfm">
</cfif>

<!-- get user details  -->
<cfquery name="Register" datasource="dating">
SELECT *
FROM dbo.Registered
WHERE dbo.Registered.RegisterID = #session.registerID#
</cfquery>

<!--  get the new photo -->
<cfoutput>
<cffile accept="image/jpeg, image/jpg, image/pjpeg, image/gif"
action="upload" attributes="normal"
destination="C:\Apache2\htdocs\profiles\photos\" filefield="form.file"
nameconflict="makeunique">
</cfoutput>

<cfset search_phrase= "#cffile.serverfile#" >
<cfset text_length = #Len(search_phrase)#>
<cfset search_word= ArrayNew(1)>
<cfset temp = ArraySet (search_word, 1, 30, "")>
<cfset word=ArrayNew(1)>
<cfset wordcount = 1>
<cfloop index = "string_count" from = "1" to = #text_length# step = "1">
<cfif #Mid(search_phrase, string_count, 1)# is not " ">
<cfset search_word[wordcount] = search_word[wordcount] & 
#Mid(search_phrase,
string_count, 1)#>
<cfelseif #Mid(search_phrase, string_count, 1)# is " ">
</cfif>
</cfloop>
<cfset newfilename=#search_word[1]#>
<!-- got new photo name -->

<!-- compare files original name to one created above -->
<cfif #search_word[1]# is not #cffile.serverfile#>
<cffile action="rename" 
destination="#cffile.ServerDirectory#\#newfilename#"
source="#cffile.ServerDirectory#\#cffile.serverfile#"></cffile>
</cfif>

<!-- update data with new photo name -->
<cfset thumbname = "thumb_#search_word[1]#">

  <cfquery datasource="dating">
                 UPDATE Registered
                 SET Photo = '#search_word[1]#', PhotoThumb ='#thumbname#'
WHERE Registered.RegisterID = #session.registerID#
  </cfquery>

<!-- create new thumbs -->
<cfoutput>
<cfexecute name = "c:\Program Files\ImageMagick-6.0.1-Q16\convert.exe"
arguments = "-sample 200x200
\apache2\htdocs\profiles\photos\#search_word[1]#
\apache2\htdocs\profiles\photos\thumbs\#thumbname#"></cfexecute>
<cfexecute name = "c:\Program Files\ImageMagick-6.0.1-Q16\convert.exe"
arguments = "-sample 125x125
\apache2\htdocs\profiles\photos\#search_word[1]#
\apache2\htdocs\profiles\photos\thumbs\small\#thumbname#"></cfexecute>
</cfoutput>

<!-- set profile for admin review and return to View Profile -->
<cflocation url="profile_updated.cfm">


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help 
-<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to