Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE Error with Netscape 6

Status
Not open for further replies.

rmz8

Programmer
Aug 24, 2000
210
US
Has anyone encountered an error with the new Netscape with regard to CFFILE? IT seems that when you try to upload a file it gives an error as if the form encoding type wasn't set to "enctype="multipart/form-data" which it is. Here is the error:

=====================
Error in CFFILE tag

The form field specified in the CFFILE tag (FILE) does not contain an uploaded file. Please be sure that you have specified the correct form field name.
=====================

Should the encoding type be set differently for Netscape 6? How would I do this?

Ryan ;-]
 
Which browsers have you tested your code with besides Netscape? Also, could you post the code for your form that you're uploading with along with the cffile code that handles it? I haven't heard of any Netscape 6 bug and didn't see any references to it on the Allaire forums.

GJ
 
I've tested the code with IE 5.5 and Netscape 4 and it works fine. Here is the code of the page where the user can upload the file (below this is the code of the actual template that processes the upload):

----------------ADD_RESOURCE.CFM----------------
[tt]<CFOUTPUT>
<HTML>
<HEAD>

<META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=iso-8859-1&quot;>
<!--Check for password in URL -->
<cfif IsDefined(&quot;Session.PWord&quot;) AND IsDefined(&quot;Session.UN&quot;)>
<!--Authorization check -->
<CFIF IsDefined(&quot;Session.Auth&quot;) is NOT TRUE>
<CFLOCATION URL=&quot;login.cfm&quot;>
<CFELSE>
<!--Run query to get user information -->
<cfquery datasource=&quot;#DSN#&quot; name=&quot;getUser&quot;>
SELECT RealName FROM Users WHERE (UserName = '#Session.UN#' AND Password = '#Session.PWord#')
</cfquery>
<cfif getuser.recordcount EQ &quot;0&quot;>
<cflocation url=&quot;login.cfm&quot;>
<cfelse>
<TITLE>ZEAL network's GATSBY: Add Resource</TITLE>
<script language=&quot;JavaScript&quot;>
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

function addCode(mode,form)
{
if (mode == &quot;BOLD&quot;)
{
form.Resource_Description.value += &quot;<b></b>&quot;;
}
else if (mode == &quot;BREAK&quot;)
{
form.Resource_Description.value += &quot;<br>&quot;;
}
}

function stupids()
{
crap = form.File.value;
arr = crap.split(&quot;.&quot;);
reg = /^((txt)|(zip)|(doc)|(pdf)|(ppt)|(htm)|(html)|(xls))$/;
if(reg.test(arr[arr.length - 1]))
{

}
else
{
alert(&quot;You can only upload Adobe PDF, HTML, Microsoft Access, Microsoft Excel, Microsoft PowerPoint, Microsoft Word, Plain Text, and ZIP files. Please select another file.&quot;);
return false;
}
}

//-->
</script>
</HEAD>


<BODY BGCOLOR=&quot;##FFFFFF&quot;><cfinclude template=&quot;../includes/header.html&quot;>
<H2><FONT FACE=&quot;Arial, Helvetica, sans-serif&quot;><U>Add Resource</U> <B><FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;></FONT></B><U><B><FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;>[<A HREF=&quot;index.cfm&quot;>Go
back</A>] </FONT></B></U></FONT></H2>
<cfform action=&quot;add.cfm&quot; method=&quot;post&quot; name=&quot;form&quot; enctype=&quot;multipart/form-data&quot;>
<input type=&quot;hidden&quot; name=&quot;Teacher&quot; value=&quot;#Session.Teacher#&quot; size=&quot;5&quot; maxlength=&quot;30&quot;>
<TABLE BORDER=&quot;0&quot;>
<TR>
<TD HEIGHT=&quot;7&quot; WIDTH=&quot;1%&quot; VALIGN=&quot;TOP&quot;><I><B><FONT SIZE=&quot;2&quot; FACE=&quot;Arial, Helvetica, sans-serif&quot;><A HREF=&quot;##&quot; onClick=&quot;MM_openBrWindow('../help/resource_title.html','','scrollbars=yes,width=200,height=200')&quot;>?</A></FONT></B></I></TD>
<TD HEIGHT=&quot;7&quot; WIDTH=&quot;25%&quot; VALIGN=&quot;TOP&quot;><FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;><B>Resource
Title:</B></FONT></TD>
<TD HEIGHT=&quot;7&quot; WIDTH=&quot;74%&quot;> <FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;>
<CFINPUT TYPE=&quot;TEXT&quot; NAME=&quot;Resource_Title&quot; VALUE=&quot;&quot; SIZE=&quot;10&quot; REQUIRED=&quot;yes&quot; MESSAGE=&quot;Please enter a title for your resource.&quot;>
</FONT></TD>
</TR>
<TR>
<TD HEIGHT=&quot;7&quot; WIDTH=&quot;1%&quot; VALIGN=&quot;TOP&quot;><I><B><FONT SIZE=&quot;2&quot; FACE=&quot;Arial, Helvetica, sans-serif&quot;><A HREF=&quot;##&quot; onClick=&quot;MM_openBrWindow('../help/resource_type.html','','scrollbars=yes,width=200,height=200')&quot;>?</A></FONT></B></I></TD>
<TD HEIGHT=&quot;7&quot; WIDTH=&quot;25%&quot; VALIGN=&quot;TOP&quot;><FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;><B>Resource
Type:</B></FONT></TD>
<TD HEIGHT=&quot;7&quot; WIDTH=&quot;74%&quot;> <FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;>
<SELECT NAME=&quot;Resource_Type&quot;>
<OPTION VALUE=&quot;Adobe PDF&quot;>Adobe PDF</OPTION>
<OPTION VALUE=&quot;HTML&quot;>HTML</OPTION>
<OPTION VALUE=&quot;Microsoft Access&quot;>Microsoft Access</OPTION>
<OPTION VALUE=&quot;Microsoft Excel&quot;>Microsoft Excel</OPTION>
<OPTION VALUE=&quot;Microsoft PowerPoint&quot;>Microsoft PowerPoint</OPTION>
<OPTION VALUE=&quot;Microsoft Word&quot; SELECTED>Microsoft Word</OPTION>
<OPTION VALUE=&quot;Plain Text&quot;>Plain Text</OPTION>
<OPTION VALUE=&quot;ZIP&quot;>ZIP</OPTION>
</SELECT>
</FONT></TD>
</TR>
<TR>
<TD HEIGHT=&quot;2&quot; WIDTH=&quot;1%&quot; VALIGN=&quot;TOP&quot;><I><B><FONT SIZE=&quot;2&quot; FACE=&quot;Arial, Helvetica, sans-serif&quot;><A HREF=&quot;##&quot; onClick=&quot;MM_openBrWindow('../help/resource_description.html','','scrollbars=yes,width=200,height=200')&quot;>?</A></FONT></B></I></TD>
<TD HEIGHT=&quot;2&quot; WIDTH=&quot;25%&quot; VALIGN=&quot;TOP&quot;>
<P><FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;><B>Resource Description:</B></FONT>
<INPUT TYPE=&quot;button&quot; VALUE=&quot;Line Break&quot; onClick=&quot;addCode('BREAK',document.form)&quot; NAME=&quot;button&quot;>
<INPUT TYPE=&quot;button&quot; VALUE=&quot;Bold&quot; onClick=&quot;addCode('BOLD',document.form)&quot; NAME=&quot;button&quot;>
<BR>
</P>
</TD>
<TD HEIGHT=&quot;2&quot; WIDTH=&quot;74%&quot;> <FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;>
<TEXTAREA NAME=&quot;Resource_Description&quot; COLS=&quot;70&quot; ROWS=&quot;8&quot; REQUIRED=&quot;Yes&quot; MESSAGE=&quot;Please enter a valid description for your resource.&quot;></TEXTAREA>
</FONT></TD>
</TR>
<TR>
<TD HEIGHT=&quot;2&quot; WIDTH=&quot;1%&quot; VALIGN=&quot;TOP&quot;><I><B><FONT SIZE=&quot;2&quot; FACE=&quot;Arial, Helvetica, sans-serif&quot;><A HREF=&quot;##&quot; onClick=&quot;MM_openBrWindow('../help/file.html','','scrollbars=yes,width=200,height=200')&quot;>?</A></FONT></B></I></TD>
<TD HEIGHT=&quot;2&quot; WIDTH=&quot;25%&quot; VALIGN=&quot;TOP&quot;><FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;><B>File:</B></FONT></TD>
<TD HEIGHT=&quot;2&quot; WIDTH=&quot;74%&quot;>
<INPUT TYPE=&quot;file&quot; id=&quot;unf&quot; NAME=&quot;File&quot;>
</TD>
</TR>
<TR>
<TD HEIGHT=&quot;2&quot; COLSPAN=&quot;3&quot;> <FONT FACE=&quot;Arial, Helvetica, sans-serif&quot; SIZE=&quot;2&quot;>
<INPUT TYPE=&quot;submit&quot; NAME=&quot;Submit&quot; VALUE=&quot;Submit&quot; onClick=&quot;return stupids()&quot;>
<INPUT TYPE=&quot;RESET&quot; NAME=&quot;Reset&quot; VALUE=&quot;Reset&quot;>
</FONT></TD>
</TR>
</TABLE>
</cfform><cfinclude template=&quot;../includes/footer.html&quot;></CFIF></cfif>
<CFELSE>
<CFLOCATION URL=&quot;login.cfm&quot;>
</CFIF>
</BODY>
</HTML>
</CFOUTPUT>[/tt]
----------------ADD_RESOURCE.CFM----------------

----------------ADD.CFM----------------
[tt]<cfif IsDefined(&quot;Session.PWord&quot;) AND IsDefined(&quot;Session.UN&quot;)>
<!--Run query to get user information -->
<cfquery datasource=&quot;#DSN#&quot; name=&quot;getUser&quot;>
SELECT RealName FROM Users WHERE (UserName = '#Session.UN#' AND Password = '#Session.PWord#')
</cfquery>
<cfif getuser.recordcount EQ &quot;0&quot;>
<cflocation url=&quot;login.cfm&quot;>
<cfelse>
<CFFILE ACTION=&quot;Upload&quot;
FILEFIELD=&quot;File&quot;
DESTINATION=&quot;#IndexDirectory#\&quot;
NAMECONFLICT=&quot;MakeUnique&quot;
ACCEPT=&quot;application/x-zip-compressed,application/pdf,application/msword,text/html,application/vnd.ms-excel,application/vnd.ms-powerpoint,text/plain,application/msaccess&quot;>
<cfoutput><cfset File_Name = &quot;#file.serverfile#&quot;></cfoutput>
<cfquery datasource=&quot;#DSN#&quot; name=&quot;insert&quot;>INSERT INTO Resources(Teacher, Resource_Description, Resource_Title, File_Name, Resource_Type) VALUES('#Form.Teacher#', '#Form.Resource_Description#', '#Form.Resource_Title#', '#File_Name#', '#Resource_Type#')</cfquery>
<CFINDEX
collection=&quot;#IndexCollection#&quot;
action=&quot;REFRESH&quot;
type=&quot;PATH&quot;
key=&quot;#IndexDirectory#\&quot;
extensions=&quot;#IndexExtensions#&quot;
recurse=&quot;#IndexRecurse#&quot;
language=&quot;#IndexLanguage#&quot;

urlPath=&quot;#urlPath#&quot;

>
<cflocation url=&quot;index.cfm&quot;></cfif>
<cfelse>
<cflocation url=&quot;logout.cfm&quot;>
</cfif>[/tt]
----------------ADD.CFM----------------

Ryan ;-]
 
Hmm.. I don't see anything that looks suspicious so my first step would be to strip everything else away and try it in it's most basic form. If this doesn't work, then I would guess it's a browser or cf tag bug. Sometimes the industry follows a convention although it's not part of the spec and then someone begins adhering to the standard and things break.

I don't have a way to test Netscape 6 at the moment so try this and let me know what happens. Put each one in a file just as I have it below so there's no JS or other coding to possibly confuse the issue. I've changed the file field name in case there's a reserved word problem and I changed the directory to &quot;c:\&quot; to remove the variable directory.

Let me know what happens,
GJ

<html><body bgcolor=&quot;#ffffff&quot;>

<form action=&quot;addtest.cfm&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;>
<INPUT TYPE=&quot;file&quot; NAME=&quot;upFile&quot;>
<input type=&quot;submit&quot;
</form>

</body</html>

Page &quot;addTest.cfm&quot;>

<html><body bgcolor=&quot;#ffffff&quot;>

<CFFILE ACTION=&quot;Upload&quot;
FILEFIELD=&quot;upFile&quot;
DESTINATION=&quot;c:\&quot;
NAMECONFLICT=&quot;MakeUnique&quot;
>

Done
</body</html>
 
It works now--I didn't change anything however. Thanks a lot GJ.

Ryan ;-]
 
hehe, nothing like the coding gremlins ;)

I would be though that it was an issue with NS that was reset once you closed it out and restarted. I use NS 4.7 and I routinely have problems with it not displaying things correctly and sometimes not even letting me click on a hyperlink. Whenever I see something strange that doesn't make sense, I'll close and re-open NS and the problem goes away a good percentage of the time.

GJ
 
Yeah, NS is weird like that.

Ryan ;-]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top