I have a problem with uploading multiple images on the MAC using IE 5 and 5.5 browsers. <CFFILE> works fine with IE and Netscape but not on OS MAC IE. I have 6 form fields for images, if uploading 6 images, it works. However if uploading less than 6, it does not work.
When using ENCTYPE="multipart/form-data", MAC IE appends characters to all form fields. And this can be resolved with using the Trim() and StripCR() functions. But it's not working for me. I also found out that when these files are uploaded to the server they are assigned temporary names as they are being uploaded. IE on the MAC catches this, and thinks it is a file name. When it tries to pass, it gives an error on the "cffile" line.
Does any one have sample uploading code that they would like to share that works for the OS MAC IE? Any help would be appreciated! Thank you.
My code is as follows:
<CFTRANSACTION>
<CFLOCK TIMEOUT="30" NAME="addTales" TYPE="EXCLUSIVE">
<CFQUERY NAME="InsertTales" DATASOURCE="#datasource#">
INSERT INTO Tales(Title, Story, SubmitDate, Program, ProgramYear, Author, Email, Approval)
VALUES('#Trim(FORM.Title)#','#Trim(FORM.EditorValue)#', '#Trim(FORM.SubmitDate)#', '#Trim(FORM.Program)#', #Trim(FORM.ProgramYear)#,'#Trim(FORM.Author)#', '#Trim(FORM.Email)#', '#Trim(Form.Approval)#')
</CFQUERY>
<CFQUERY Name="GetLastTalesID" DataSource="#datasource#">
SELECT MAX(TalesID) AS LastStoryID
FROM Tales
WHERE Title='#Trim(Form.title)#'
AND author='#Trim(Form.author)#'
</CFQUERY>
<!----check to see if the total file size being uploaded is too big----->
<CFIF VAL(CGI.CONTENT_LENGTH) GT #maxFileSize#>
Photos that you have uploaded are too large. This article has not been submitted.<br>
<CFABORT>
<CFELSE>
<!---1st image--->
<CFIF Trim(StripCR(Form.File1)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file1" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage1" DATASOURCE="#datasource#">
UPDATE Tales
SET Image1='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file1 empty---->
<!---2nd Image--->
<CFIF Trim(StripCR(Form.File2)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file2" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage2" DATASOURCE="#datasource#">
UPDATE Tales
SET Image2='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file2 empty---->
<!---3 Image--->
<CFIF Trim(StripCR(Form.File3)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file3" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage3" DATASOURCE="#datasource#">
UPDATE Tales
SET Image3='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file3 empty---->
<!---4 Image--->
<CFIF Trim(StripCR(Form.File4)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file4" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage4" DATASOURCE="#datasource#">
UPDATE Tales
SET Image4='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file4 empty---->
<!---5 Image--->
<CFIF Trim(StripCR(Form.File5)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file5" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage5" DATASOURCE="#datasource#">
UPDATE Tales
SET Image5='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file5 empty---->
<!---6 Image--->
<CFIF Trim(StripCR(Form.File6)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file6" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage6" DATASOURCE="#datasource#">
UPDATE Tales
SET Image6='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file6 empty---->
</CFIF><!----end of if file size is too large--->
</cflock>
</CFTRANSACTION>
When using ENCTYPE="multipart/form-data", MAC IE appends characters to all form fields. And this can be resolved with using the Trim() and StripCR() functions. But it's not working for me. I also found out that when these files are uploaded to the server they are assigned temporary names as they are being uploaded. IE on the MAC catches this, and thinks it is a file name. When it tries to pass, it gives an error on the "cffile" line.
Does any one have sample uploading code that they would like to share that works for the OS MAC IE? Any help would be appreciated! Thank you.
My code is as follows:
<CFTRANSACTION>
<CFLOCK TIMEOUT="30" NAME="addTales" TYPE="EXCLUSIVE">
<CFQUERY NAME="InsertTales" DATASOURCE="#datasource#">
INSERT INTO Tales(Title, Story, SubmitDate, Program, ProgramYear, Author, Email, Approval)
VALUES('#Trim(FORM.Title)#','#Trim(FORM.EditorValue)#', '#Trim(FORM.SubmitDate)#', '#Trim(FORM.Program)#', #Trim(FORM.ProgramYear)#,'#Trim(FORM.Author)#', '#Trim(FORM.Email)#', '#Trim(Form.Approval)#')
</CFQUERY>
<CFQUERY Name="GetLastTalesID" DataSource="#datasource#">
SELECT MAX(TalesID) AS LastStoryID
FROM Tales
WHERE Title='#Trim(Form.title)#'
AND author='#Trim(Form.author)#'
</CFQUERY>
<!----check to see if the total file size being uploaded is too big----->
<CFIF VAL(CGI.CONTENT_LENGTH) GT #maxFileSize#>
Photos that you have uploaded are too large. This article has not been submitted.<br>
<CFABORT>
<CFELSE>
<!---1st image--->
<CFIF Trim(StripCR(Form.File1)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file1" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage1" DATASOURCE="#datasource#">
UPDATE Tales
SET Image1='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file1 empty---->
<!---2nd Image--->
<CFIF Trim(StripCR(Form.File2)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file2" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage2" DATASOURCE="#datasource#">
UPDATE Tales
SET Image2='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file2 empty---->
<!---3 Image--->
<CFIF Trim(StripCR(Form.File3)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file3" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage3" DATASOURCE="#datasource#">
UPDATE Tales
SET Image3='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file3 empty---->
<!---4 Image--->
<CFIF Trim(StripCR(Form.File4)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file4" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage4" DATASOURCE="#datasource#">
UPDATE Tales
SET Image4='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file4 empty---->
<!---5 Image--->
<CFIF Trim(StripCR(Form.File5)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file5" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage5" DATASOURCE="#datasource#">
UPDATE Tales
SET Image5='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file5 empty---->
<!---6 Image--->
<CFIF Trim(StripCR(Form.File6)) IS NOT "">
<!---Call CF_AutoResize --->
<cf_autoresize imagepath="#varDestination#" maxsize="#Trim(form.maxsize)#" thumbsize="#Trim(form.thumbsize)#" prefix="#Trim(form.prefix)#" filefield="file6" thumbpath="#Trim(thumbpath)#">
<!---Outputs the variables #photo# and #thumbnail#--->
<CFQUERY name="InsertImage6" DATASOURCE="#datasource#">
UPDATE Tales
SET Image6='#photo#'
WHERE TalesID=#Val(GetLastTalesID.LastStoryID)#
</CFQUERY>
</CFIF><!----end of if file6 empty---->
</CFIF><!----end of if file size is too large--->
</cflock>
</CFTRANSACTION>