cffile filefield error???

121 views
Skip to first unread message

Bill Foresman

unread,
Feb 25, 2016, 9:05:53 AM2/25/16
to Lucee
this is the error from lucee:

Lucee 4.5.3.005 Error (application)
Messageform field [myimage] is not a file field.
StacktraceThe Error Occurred in
C:\www\wfbsusa.com\LevyTaxCollector\_admin\ssi\slideshow.cfm: line 51 
49: <td valign="top"><cfinput type="Text" name="title" value="#title#" message="A title is required." required="Yes" size="15" maxlength="50"><br>
50: <textarea cols="60" rows="2" name="message">#message#</textarea><br>
51: <cffile action="upload" filefield="myimage" destination="../data1/images" nameconflict="overwrite" accept="image/jpg">
52: <input type="submit" name="action" value="update" class="button"></td>
53: </cfform>

Mark Drew

unread,
Feb 25, 2016, 9:07:51 AM2/25/16
to lucee
Methinks you didn’t put enctype="multipart/form-data” in your form?

Otherwise without code, can’t help you much. 

MD 

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/b54cbb46-0a9c-4c72-965d-0ce77c220134%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bill Foresman

unread,
Feb 25, 2016, 9:10:02 AM2/25/16
to Lucee
I'm sure it's something simple but that's in there:

<cfform action="index.cfm?nav=slideshow&action=edit slideshow" method="POST" enctype="multipart/form-data" name="form#sid#">
<input type="hidden" name="sid" value="#sid#">
<td><img src="../data1/images/#image#" width="200"></td>
<td valign="top"><cfinput type="Text" name="title" value="#title#" message="A title is required." required="Yes" size="15" maxlength="50"><br>
<textarea cols="60" rows="2" name="message">#message#</textarea><br>
<cffile action="upload" filefield="myimage" destination="../data1/images" nameconflict="overwrite" accept="image/jpg">
<input type="submit" name="action" value="update" class="button"></td>
</cfform>

Mark Drew

unread,
Feb 25, 2016, 9:12:57 AM2/25/16
to lucee
Well 
that is not how you use the <cffile> tag. So there is that. 

The cffile tag will RECEIVE the form post. You probably want a <cfinput type=“file”>  in there instead. 


Regards


MD 

-- 
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
--- 
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Phillip Vector

unread,
Feb 25, 2016, 9:14:49 AM2/25/16
to lu...@googlegroups.com
You are trying to put a command to upload in the form. Is this really what you are trying to do?

What it is saying is that the variable "myimage" is not a file field in the form.

Even if it was in the form, you haven't submitted it yet. The code needs to be on the submit page.

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Phillip Vector

unread,
Feb 25, 2016, 9:16:33 AM2/25/16
to lu...@googlegroups.com
Also, it's a bad coding practice to put a space in an URL.

Bill Foresman

unread,
Feb 25, 2016, 9:20:46 AM2/25/16
to Lucee


On Thursday, February 25, 2016 at 9:05:53 AM UTC-5, Bill Foresman wrote:

Adam Cameron

unread,
Feb 25, 2016, 9:26:48 AM2/25/16
to Lucee
You'd do well to look at the example code on the very page you just linked to.

Mark Drew

unread,
Feb 25, 2016, 9:27:25 AM2/25/16
to lucee
Yes, 
but you post a form with a <input type=“file”> to the server and then <cffile action=“upload”> takes care of it. 

MD 

-- 
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
--- 
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Bill Foresman

unread,
Feb 25, 2016, 9:27:59 AM2/25/16
to lu...@googlegroups.com
that's great but I'm using the example from what I can see.

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to a topic in the Google Groups "Lucee" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lucee/ljQflPRlPfM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lucee+un...@googlegroups.com.

To post to this group, send email to lu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Bill Foresman

Phillip Vector

unread,
Feb 25, 2016, 9:31:49 AM2/25/16
to lu...@googlegroups.com
You aren't.

The form takes the code and inputs and sends it to the processing page that has cffile.

You are quite literally telling the server to upload a file without telling it what file to upload.

Please review the example again and if it's still confusing to you, I offer cheap rates. :)

You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.

To post to this group, send email to lu...@googlegroups.com.

Mark Drew

unread,
Feb 25, 2016, 9:32:54 AM2/25/16
to lucee
That is a bad example: 


Here is a better one with your code in it:


<cfparam name="FORM.action" default="">

<cfif isEmpty(FORM.action)>

You haven’t submitted the form. better do it now! 

<cfform action="index.cfm?nav=slideshow&action=edit slideshow" method="POST" enctype="multipart/form-data" name="form#sid#">
<input type="hidden" name="sid" value="#sid#">
<td><img src="../data1/images/#image#" width="200"></td>
<td valign="top"><cfinput type="Text" name="title" value="#title#" message="A title is required." required="Yes" size="15" maxlength="50"><br>
<textarea cols="60" rows="2" name="message">#message#</textarea><br>
<input type="image" name="myImage">
<input type="submit" name="action" value="update" class="button"></td>
</cfform>

<cfelse>
You have submitted the form! Go you! 
<cffile action="upload" filefield="myimage" destination="../data1/images" nameconflict="overwrite" accept="image/jpg">


</cfif>


On 25 Feb 2016, at 14:20, Bill Foresman <bi...@foresman.com> wrote:

-- 
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
--- 
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Adam Cameron

unread,
Feb 25, 2016, 9:34:10 AM2/25/16
to Lucee
On Thu, Feb 25, 2016 at 9:26 AM, Adam Cameron <camero...@gmail.com> wrote:
You'd do well to look at the example code on the very page you just linked to.


On Thursday, 25 February 2016 14:27:59 UTC, Bill Foresman wrote:
that's great but I'm using the example from what I can see.


No, you are not.

This is your code:

<cfform action="index.cfm?nav=slideshow&action=edit slideshow" method="POST" enctype="multipart/form-data" name="form#sid#">
<input type="hidden" name="sid" value="#sid#">
<td><img src="../data1/images/#image#" width="200"></td>
<td valign="top"><cfinput type="Text" name="title" value="#title#" message="A title is required." required="Yes" size="15" maxlength="50"><br>
<textarea cols="60" rows="2" name="message">#message#</textarea><br>
<cffile action="upload" filefield="myimage" destination="../data1/images" nameconflict="overwrite" accept="image/jpg">
<input type="submit" name="action" value="update" class="button"></td>
</cfform>


And this is the example code:

<!--- Windows Example --->
<!--- Check to see if the Form variable exists. --->
<cfif isDefined("Form.FileContents") >
   
<!--- If TRUE, upload the file. --->
   
<cffile action = "upload"  
       
fileField = "FileContents"  
       
destination = "c:\files\upload\"  
       
accept = "text/html"  
       
nameConflict = "MakeUnique">
<cfelse>
   
<!--- If FALSE, show the Form. --->
    <form method="post" action=
<cfoutput>#cgi.script_name#</cfoutput>  
        name="uploadForm" enctype="multipart/form-data">
       
<input name="FileContents" type="file">
       
<br>
       
<input name="submit" type="submit" value="Upload File">  
   
</form>
</cfif>



Not at all the same. Actually look at it, and pay attention to how it works. Heck... run it.





Bill Foresman

unread,
Feb 25, 2016, 9:42:51 AM2/25/16
to lu...@googlegroups.com
doesn't work either. No file upload.

You received this message because you are subscribed to a topic in the Google Groups "Lucee" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lucee/ljQflPRlPfM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lucee+un...@googlegroups.com.

To post to this group, send email to lu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mark Drew

unread,
Feb 25, 2016, 9:48:25 AM2/25/16
to lucee

Bill Foresman

unread,
Feb 25, 2016, 9:49:17 AM2/25/16
to lu...@googlegroups.com
Got it working between all the suggestions. Thanks.


For more options, visit https://groups.google.com/d/optout.

Phillip Vector

unread,
Feb 25, 2016, 9:49:19 AM2/25/16
to lu...@googlegroups.com
PLEASE tell me you changed the destination to a directory that actually exists.

Look, I realize you are new.. We don't mind teaching you a bit. But you have to make an effort to learn how to code yourself. If you aren't willing to put in that effort and try to understand the code examples, then you may want to reconsider if coding is for you.

Again, if you are just some guy who took on a job to work on this guys website (which it seems to be since your phone number is different then the business one), then perhaps you should let him know that it isn't working out and send him to a coder who knows what they are doing.

Denard Springle

unread,
Feb 26, 2016, 8:10:05 PM2/26/16
to Lucee, vec...@mostdeadlygame.com
Classic example of the Dunning-Kruger effect there Phillip. What may seem easy for you may not seem easy to someone else, as appears to be the case here with Bill. 

Chasing new developers away is *not* how one helps to build a community. As a more skilled developer you should try and approach the newbro's with open arms and help guide them, not mock them for what they don't know, or suggest they are too stupid to learn. You would do well to remember what it was like when you first started developing.

Not condemnation, just sage advice.

-- Denny

Phillip Vector

unread,
Feb 26, 2016, 8:14:06 PM2/26/16
to lu...@googlegroups.com
I'm perfectly willing to help new developers learn how to program. 

But once someone says "I ran that exact code" and it's clear they didn't, at that point, I feel a little driving away is needed.

Would you be willing to help teach someone who was not willing to do a simple copy and paste?

Denard Springle

unread,
Feb 26, 2016, 8:18:37 PM2/26/16
to Lucee, vec...@mostdeadlygame.com
> Would you be willing to help teach someone who was not willing to do a simple copy and paste?

Yes I would, and I have. And yes, it is possible to copy & paste some code from an example and still not have a clue what it does... especially when you're new to development.

-- Denny

Phillip Vector

unread,
Feb 26, 2016, 8:25:15 PM2/26/16
to lu...@googlegroups.com
Bill: but I'm using the example from what I can see.

His code
49: <td valign="top"><cfinput type="Text" name="title" value="#title#" message="A title is required." required="Yes" size="15" maxlength="50"><br>
50: <textarea cols="60" rows="2" name="message">#message#</textarea><br>
51: <cffile action="upload" filefield="myimage" destination="../data1/images" nameconflict="overwrite" accept="image/jpg">
52: <input type="submit" name="action" value="update" class="button"></td>
53: </cfform>


Actual code
<!--- Windows Example ---> 
<!--- Check to see if the Form variable exists. ---> 
<cfif isDefined("Form.FileContents"> 
    
<!--- If TRUE, upload the file. ---> 
    
<cffile action = "upload"  
        
fileField = "FileContents"  
        
destination = "c:\files\upload\"  
        
accept = "text/html"  
        
nameConflict = "MakeUnique"> 
<cfelse> 
    
<!--- If FALSE, show the Form. ---> 
    <form method="post" action=
<cfoutput>#cgi.script_name#</cfoutput>  
        name="uploadForm" enctype="multipart/form-data"> 
        
<input name="FileContents" type="file"> 
        
<br> 
        
<input name="submit" type="submit" value="Upload File">  
    
</form> 
</cfif>


Are you saying he confused his code for the code given? How is his code ANYTHING like the actual code?

I'm sorry. I understand you might have no issue banging your head against the wall, but I feel that if someone comes here and refuses to do any work to fix the code, he shouldn't be helped. He was told how to fix it, but his response to it was that his code should work and he refused to run the actual code.

To me, that's a programmer I'd rather not have in the field giving CFML a bad name (presuming that he was a programmer. I think he may have been the guy who owns the website).

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Denard Springle

unread,
Feb 26, 2016, 8:31:10 PM2/26/16
to Lucee, vec...@mostdeadlygame.com
Yes, 'I'm using the example from what I can see' - or, in other words, 'I have some of the same stuff from the example in my code, so it should work, right?'.

To me that seemed a genuine misunderstanding and not 'I'm too lazy to learn anything', as you are suggesting.

And the only way to make CFML developers better is if the experienced ones have patience and teach the newbro's how to code better right out of the gate.

He could be the site owner, he could be a new developer - it doesn't really matter who he is... what matters is he reached out here for help, and what he received was mocking. Any way you slice it, that's inappropriate IMHO.

-- Denny
Reply all
Reply to author
Forward
0 new messages