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  cfsqltype =
"cf_sql_varchar"  value = "#photo75x50#" >,
                                           <cfqueryparam  cfsqltype =
"cf_sql_varchar"  value = "#photo458x306#" >,
                                           <cfqueryparam  cfsqltype =
"cf_sql_int"      value = "#loopCounter#" >

                                         )
        

                    </cfquery>
                                                        
                </cfif> <!--- [ cfif isImageFile ] --->

                <cfset loopCounter = loopCounter + 1 />

            </cfloop> <!--- [ imageList name ] --->

        </cfif> <!--- [ imageList.recordCount gt 0 ] --->
                                                
    </cfif> <!--- [ if structKeyExists, imageFileField ] --->

</cfloop> <!--- [ image 1 to 100 ] --->


<cfset addPropertyStruct.STATUS = 'Success' />
                                        
<cfreturn addPropertyStruct     />



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:350918
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to