- see footer for list info -<
Thanks for the help all ......

I'll have another play with tonight. It is working but at present will allow all image types because of the wild card - I'll try that other line Duncan. Yeah I appreciate I need some better error checking there to make sure all is well. I did this code in a real hurry about 3 years ago for an estate agent. Of course now its come back to bite me .....

Regards - Paul


From: "Duncan Cumming" <[EMAIL PROTECTED]>
Reply-To: Coldfusion Development <[email protected]>
To: <[email protected]>
Subject: Re: [CF-Dev] cffile - firefox
Date: Mon, 15 Jan 2007 09:38:46 +0000

>- see footer for list info -<
Paul, I'd guess it's something to do with the allowed filetypes not being correct. Change this line:
accept = "image/jpg, image/pjpeg, image/jpeg, image/pjpg"

What's happening is the image being uploaded doesn't meet the upload criteria. You also need to fix your code to take this into account, e.g. if they try to upload a .gif, you'll still get this problem. Likewise if you try and upload something other than a .pdf into the PDF box, I bet it gives you a similar error. I remember you had this problem ages ago which has obviously reared it's head again!

Set a local variable to the filename of the successfully uploaded file. This will fix your problems, as if the file doesn't upload, it will just insert an empty string into the table.


<cfset pdfFile = "">
<cfif #file.filewassaved# eq "yes"><!--- Were the details saved? --->
        <cfset pdfFile = '#file.serverfile#'>
        <!---<cfdump var="#CFFILE#" label="first upload">--->
</cfif>

<cfset imageFile = "">
<cfif #file.filewassaved# eq "yes"><!--- Was the small pic saved? --->
        <cfset imageFile = '#trim(file.serverfile)#'>
</cfif>

<CFQUERY NAME="AddProperty" datasource="#application.DSN#">
                        INSERT INTO tblPropertyDetails
                                (NoBedroomsIDFK,
                                PropertyTypeIDFK,
                                PropertyLocationIDFK,
                                RoadName,
                                Picture,
                                Description1,
                                Description2,
                                Description3,
                                Description4,
                                Description5,
                                Description6,
                                SellingPrice,
                                PostCode,
                                PDFDetails)
                        VALUES
                                ('#form.Select_Bedrooms#',
                                '#form.Select_Type#',
                                '#form.Select_Location#',
                                '#trim(form.RoadName)#',
                                '#trim(imageFile)#',
                                '#trim(form.Description1)#',
                                '#trim(form.Description2)#',
                                '#trim(form.Description3)#',
                                '#trim(form.Description4)#',
                                '#trim(form.Description5)#',
                                '#trim(form.Description6)#',
                                CAST('#FORM.SellingPrice#' AS MONEY),
                                '#trim(PostCode)#',
                                '#trim(pdfFile)#')
                                SELECT @@IDENTITY AS NewID
                </CFQUERY>



Duncan Cumming
New Media Developer
Customer Relations Management / Education
Fife Council
700 4105 / 01592 414105

>>> [EMAIL PROTECTED] 14/01/2007 14:16 >>>
>- see footer for list info -<
I have an application which uploads pictures using cffile.

The problem with fire fox is that its writing this to the database

C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\wwwroot-tmp\neotmp1633.tmp

Can anyone PLEASE help me sort this. I have no idea how to code this
differently to resolve the problem,

The Code .....

<CFTRY>
        <!--- UPLOAD THE PROPERTY DETAILS --->
        <cffile action ="UPLOAD"
        filefield ="details"
        nameconflict = "overwrite"
        accept = "application/pdf"
        destination = "#application.uploadDetails#">

<cfif #file.filewassaved# eq "yes"><!--- Were the details saved? --->
        <cfset details = '#file.serverfile#'>
        <!---<cfdump var="#CFFILE#" label="first upload">--->
</cfif>
<CFCATCH><CFSET errormessage = "Please enter a file"></CFCATCH>
</CFTRY>

<CFTRY>
<!--- UPLOAD THE SMALL PROPERTY PICTURE --->
<cffile action ="UPLOAD"
filefield ="smallpic"
nameconflict = "overwrite"
accept = "image/jpg, image/pjpeg"
destination = "#application.UploadDirectory#">
<cfif #file.filewassaved# eq "yes"><!--- Was the small pic saved? --->
        <cfset smallpic = '#trim(file.serverfile)#'>
        <!---<cfdump var="#CFFILE#" label="Second upload">
        <cfabort>--->
<!---<cfelse>
        The picture was not saved
        <cfabort>--->
</cfif>
<CFCATCH><CFSET errormessage = "Please enter a file"></CFCATCH>
</CFTRY>


<!--- Add the property to the database --->
<CFQUERY NAME="AddProperty" datasource="#application.DSN#">
                        INSERT INTO tblPropertyDetails
                                (NoBedroomsIDFK,
                                PropertyTypeIDFK,
                                PropertyLocationIDFK,
                                RoadName,
                                Picture,
                                Description1,
                                Description2,
                                Description3,
                                Description4,
                                Description5,
                                Description6,
                                SellingPrice,
                                PostCode,
                                PDFDetails)
                        VALUES
                                ('#form.Select_Bedrooms#',
                                '#form.Select_Type#',
                                '#form.Select_Location#',
                                '#trim(form.RoadName)#',
                                '#trim(smallpic)#',
                                '#trim(form.Description1)#',
                                '#trim(form.Description2)#',
                                '#trim(form.Description3)#',
                                '#trim(form.Description4)#',
                                '#trim(form.Description5)#',
                                '#trim(form.Description6)#',
                                CAST('#FORM.SellingPrice#' AS MONEY),
                                '#trim(PostCode)#',
                                '#trim(Details)#')
                                SELECT @@IDENTITY AS NewID
                </CFQUERY>


The PDF for the property details works fine its just the picture....

HELP !!!!

Regards - Paul


_______________________________________________

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

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

**********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed and should not be disclosed to any other party. If you have received this email in error please notify your system manager and the sender of this message.

This email message has been swept for the presence of computer viruses but no guarantee is given that this e-mail message and any attachments are free from viruses.

Fife Council
Tel: 08451 55 00 00
************************************************

_______________________________________________

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

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- 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:-
- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to