• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

Null Pointers are another name for undefined values.

Hi Experts,

I am using a simple CFFILE tag to upload a file from a web form to my server, but I keep getting the following error:

The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.  
 
 
The Error Occurred in E:\traveldirectors\etd_tdapplicationEmailSent.cfm: line 59
 
57 :             DESTINATION="E:\FilesCust\"
58 :             NAMECONFLICT="MakeUnique"            
59 :             ATTRIBUTES="normal">
60 :
61 :       <CFSET appFileName1 = "#CFFILE.ClientFile#">
 

Any help would be appreciated.

Thanks
R

0
Raj_IN
Asked:
Raj_IN
  • 3
  • 3
  • 2
  • +3
1 Solution
 
kkhippleCommented:

<CFIF CFFILE.ClientFile NEQ "">
  <CFSET appFileName1 = "#CFFILE.ClientFile#">
</CFIF>
0
 
mrichmonCommented:
<CFIF Len(CFFILE.ClientFile) NEQ 0>
  <CFSET appFileName1 = CFFILE.ClientFile>
</CFIF>
0
 
kkhippleCommented:
you can also use a CFTRY and CFCATCH block like so

<CFTRY>
   <CFFILE .... >
<CFCATCH type="any"></CFCATCH>
</CFTRY>

http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=7&threadid=911922&enterthread=y#3256942
0
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

 
Raj_INAuthor Commented:
OK. here is my code

<CFTRY>

      <CFFILE ACTION="upload"
            FILEFIELD="Form.appform"
            DESTINATION="E:\FilesCust\"
            NAMECONFLICT="MakeUnique"
            ACCEPT="text/plain,image/jpg,image/gif,image/jpeg,application/pdf,application/msword"            
            ATTRIBUTES="normal">

      <CFSET appFileName1 = "#CFFILE.ClientFile#">
      <CFSET appFileName = "#CFFILE.ServerFile#">

      <CFCATCH TYPE="Application">

            <CFSET errorFile = "Application Form">
            <CFSET continue = "F">

      </CFCATCH>


</CFTRY>

I have javascript validators on the form that prevents any null entry from getting passed on.

Any other suggestions?
0
 
Tacobell777Commented:
<CFFILE ACTION="upload"
          FILEFIELD="appform"
          DESTINATION="E:\FilesCust\"
          NAMECONFLICT="MakeUnique"
          ACCEPT="text/plain,image/jpg,image/gif,image/jpeg,application/pdf,application/msword"          
          ATTRIBUTES="normal">

Try it without the Form. in the filefield
0
 
Raj_INAuthor Commented:
I tried without "Form." in filefield, but with no success. Any other suggestions?
0
 
Renante EnteraCommented:
Hello Raj_IN!

I think "Form.appform" is not defined...  Try to put a conditional statement before you <cffile> tag to make sure that you have pass a specific value for that form variable.

Have it this way :

<CFIF IsDefined('Form.appform')>
     <CFFILE ACTION="upload"
          FILEFIELD="appform"
          DESTINATION="E:\FilesCust\"
          NAMECONFLICT="MakeUnique"
          ACCEPT="text/plain,image/jpg,image/gif,image/jpeg,application/pdf,application/msword"          
          ATTRIBUTES="normal">

     <CFSET appFileName1 = "#CFFILE.ClientFile#">
     <CFSET appFileName = "#CFFILE.ServerFile#">
     <!--- And so on and so forth --->
</CFIF>

Hope this helps you.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0
 
Renante EnteraCommented:
In addition to that, for some tutorial on [cffile action="upload"].

Just visit the site : http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p35.htm#wp3540091


Regards!
eNTRANCE2002 :-)
0
 
Raj_INAuthor Commented:
Hey guys,

I finally fixed the problem. The fix to the problem turned out to be someplace else. The form that was submitting the file had "GET" method instead of "POST". This is quite an interesting discovery. I work with another designer who uses some authoring tool (probably dreamweaver MX) to apply his design template/CSS to the .cfm pages I write. Looks like the form method got changed during one such design modification without his knowledge.

Thanks again! I appreciate your time.

0
 
Renante EnteraCommented:
That's great Raj_IN!

Referring to my first post, it can track down the form field that you want to pass for your <cffile> attribute "filefield" since you are checking if it exists.

Actually, the site that I have stated on my latest post provides an example on how to use [cffile action="upload"].  Perhaps, if you have read it then you can have an idea on how to debug your problem.


Best regards!
eNTRANCE2002 :-)
0
 
moduloCommented:
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now