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

Raj_INAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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 EnteraSenior PHP DeveloperCommented:
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 EnteraSenior PHP DeveloperCommented:
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 EnteraSenior PHP DeveloperCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.