OK...last newbie question.
How do i add more than one photo to this code below. I added 4 new fields in
the DB called (image2, image3, image4, image5) and 4 more cfinputs with the
same names as the DB.
Thanks
Barry
This code below works when adding 1 photo.
> <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:329149
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4