Hi, Brian, and thanks for the feedback...
What, in particular, do you think is wrong with the loopCounter variable?
I moved it over the last few days thinking that might be the problem.
And, concerning the imagenumberindex... same question as above.
And how were you able to test the code? Did you set up some file fields
in a form and submit them to the cfc method?
My client has been patient with this problem, but I may have to re-write
this code as a plain-old, "submit the form to a .cfm processing page for
the data, and repeat for the photos" solution. I haven't been able to
find the problem while using HTML, AJAX, IFrame, and a CFC method. Usually,
I can troubleshoot this setup without any problem. But I just can't seem
to get a handle on this one.
Rick
-----Original Message-----
From: Brian Thornton [mailto:
Brian@CFDe...]
Sent: Tuesday, May 01, 2012 1:00 PM
To: cf-talk
Subject: Re: Anyone see anything wrong with this code?
The problem seems to be the loopCounter and the imagenumberindex on my end.
On Tue, May 1, 2012 at 12:57 PM, Rick Faircloth
<
Rick@whit...> wrote:
>
> Hi, all...
>
> I've just moved onto a new server and it seems
> that ever since that time, I've had problems getting
> this code to work.
>
> The code has been tweaked a lot, here, there, and
> everywhere over the last several days trying to figure
> out why it won't work.
>
> I can't give any clues on error messages, because this
> is part of a cfc on the back end of an ajax call.
> No errors show up in firebug or elsewhere.
>
> The breakdown the method occurs where this code begins.
> Prior to this code, data for a properly listing is inserted
> into a MySQL database...no problem.
>
> And, I should say that the code works through line 20, where
> the images are first written to the temp-images directory.
> The problem is that no files are written to the final directory
> and no entries are made into the table for the photos.
> This code has been running on another server for the last couple
> of years. (Plus the tweaks!) I had the temp directory outside
> the web root, but brought it inside the web root thinking that
> might be the problem, but it didn't help.
>
> I broke out the individual functions of this code and ran them
> locally and everything checked out locally, but combined and on
> the server, no go...
>
> Thanks for any feedback!
>
> Rick
>
> <cfquery name = "qGetLastInsertID" datasource = "myDatasource">
>
> select LAST_INSERT_ID() as propertyID
> from rentalProperties
>
> </cfquery>
>
> <cfset loopCounter = 1>
>
> <cfloop index="imageNumber" from="1" to="100" step="1">
>
> <cfset imageFileField = '#imageNumber#_propertyPhoto' />
>
> <cfif (StructKeyExists(FORM, imageFileField) AND
> Len(FORM[imageFileField]))>
>
> <cffile action = "upload"
> filefield = "#imageFileField#"
> destination =
> "e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images"
> accept = "image/jpg, image/pjpg, image/jpeg,
> image/pjpeg, image/png"
> nameConflict = "makeUnique" />
>
>
> <cfset originalImageFileName = '#cffile.serverFileName#' />
> <cfset newImageFileName = reReplace(#originalImageFileName#,
> [^a-zA-Z0-9_\-.], '', 'all') />
> <cfset originalImageExt = '#cffile.serverFileExt#' />
> <cfset newFileNameComplete =
> '#newImageFileName##originalImageExt#' />
>
>
> <cfdirectory action = "list"
> directory =
> "e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images"
> name = "image_list" />
>
> <cfif image_list.recordCount gt 0 >
>
> <cfloop query = "image_list">
>
> <cfif name is '#newFileNameComplete#' >
>
> <cffile action = "rename"
> source =
>
"e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images\#newFileNameCompl
> ete#"
> destination =
>
"e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images\#newImageFileName
> #_#loopCounter##originalImageExt#">
>
> <cfset renamedNewFileNameComplete =
> '#newImageFileName#_#loopCounter##originalImageExt#'/>
>
> <cfelse>
>
> <cfset renamedNewFileNameComplete =
> '#newFileNameComplete#' />
>
> </cfif>
>
>
> <cfif
>
isImageFile('e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images\#rena
> medNewFileNameComplete#') >
>
> <cfimage action = "resize"
> width = "200"
> height = ""
> source =
>
"e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images\#renamedNewFileNa
> meComplete#"
> destination =
>
"e:\inetpub\webroot\holtzmanRentals\user_images\photo200_#renamedNewFileName
> Complete#"
> overwrite = "true" />
>
> <cfset photo200 =
> "photo200_#renamedNewFileNameComplete#">
>
> <cfimage action = "resize"
> width = "75"
> height = "50"
> source =
>
"e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images\#renamedNewFileNa
> meComplete#"
> destination =
>
"e:\inetpub\webroot\holtzmanRentals\user_images\photo75x50_#renamedNewFileNa
> meComplete#"
> overwrite = "true" />
>
> <cfset photo75x50 =
> "photo75x50_#renamedNewFileNameComplete#" />
>
> <cfimage action = "resize"
> width = "458"
> height = "306"
> source =
>
"e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images\#renamedNewFileNa
> meComplete#"
> destination =
>
"e:\inetpub\webroot\holtzmanRentals\user_images\photo458x306_#renamedNewFile
> NameComplete#"
> overwrite = "true" />
>
> <cfset photo458x306 =
> "photo458x306_#renamedNewFileNameComplete#" />
>
> <cffile action = "delete"
> file =
>
"e:\inetpub\webroot\holtzmanRentalsSiteManager\temp-images\#renamedNewFileNa
> meComplete#" />
>
>
> <cfquery name = "qInsertPhotos"
> datasource="myDatasource">
>
> insert
> into rentalPhotos
>
> ( propertyID, photo200,
photo75x50,
> photo458x306, photoOrder )
>
>
> values ( <cfqueryparam cfsqltype =
> "cf_sql_int" value = "#qGetLastInsertID.propertyID#" >,
> <cfqueryparam cfsqltype =
> "cf_sql_varchar" value = "#photo200#" >,
> <cfqueryparam cfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350924
Subscription:
http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
opensubscriber is not affiliated with the authors of this message nor responsible for its content.