Yes and Yes. The DB and the directory is perfect. I was just wondering if I was 
leaving a temp image on the server every time I upload an image.

>Hi, Barry...sorry I took so long to get back to you...busy weekend.
>
>The code looks good as far as I can tell...the proof is always in the
>results.
>
>You're now getting the correct filename in the db...are you also getting
>the image into the correct directory after uploading?
>
>Rick
>
>Hello.
>
>I was able to upload an image and add it to my DB using CF8 and MySQl this
>weekend.
>
>Can somebody tell me if this is correct. There are no error messages and the
>DB is also correct.
>
>Thanks
>
>Barry
>
>     <cfset thisDir = expandPath("images")>
><!--- Determine whether the form is uploaded with the image. --->
>
><cfif IsDefined("image") AND image IS NOT "" and len(trim(form.image))>
><!--- Determine whether the image file exceeds the size limits.---> 
><cfimage action="read" source="#form.image#" name="myImage">
><cfif myImage.width lt 100 
>or myImage.height lt 100
>or myImage.width gt 1000
>or myImage.height gt 1000>
><cfthrow message="Please provide an image between 100 and 1000 pixels tall
>and wide.">
><cflocation url="demo.cfm">
><cfelse>
>
><!--- Use the cffile tag to upload the image file. --->
><cffile action="upload"
>fileField="image"
>destination="#thisDir#"
>result="fileUpload"
>nameconflict="makeunique" accept="image/jpeg,image/jpg,image/png">    
>
>       <cfset newImageName = fileUpload.serverDirectory
>        & fileUpload.serverFilename 
>        & fileUpload.serverFileExt>
>  
></cfif>
></cfif>
>
><!--- Insert into the database --->
>       <cfquery datasource="mydb">
>INSERT INTO artists(
>                    image
>                   )
>                            
>VALUES( 
>        '#fileUpload.serverFile#')
></cfquery> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329139
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to