Getting Error: The form field "FileURL" did not contain a file

This is a basic update page with the ability to change the file uploaded, or just leave the current one, or use none at all.

                <cfif FORM.FileURL NEQ "">
      <cfset FileURL = FILE.ClientFile>
      <cfelseif FORM.CurrentFile NEQ "">
      <cfset FileURL = #FORM.CurrentFile#>
      <cfset FileURL = 'None Assigned' >
<cfquery datasource="vpr">
      UPDATE tcoLicensing
            FileURL = '#FileURL#'
            WHERE ID = '#FORM.ID#'

Hopefully you can see what I am trying to do.  If a file field in "FileURL" exists, then use it, if not and something is in "CurrentFile", then use it, if neither of those, enter 'None Assigned'.  So, I need it to work, even when no file was entered.  

thanks experts!!!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

The form that's passing in the variables needs to have <form enctype="multipart/form-data">.  You will also need to change your check to this:

<cfif Form.FileUrl NEQ>
  <cffile action="upload" filefield="FileURL" destination="/u/web/users/research/tco/technologies/" nameconflict="MakeUnique" accept="application/*">
  <cfset FileURL = FILE.ClientFile>
  <cfelseif FORM.CurrentFile NEQ "">
  <cfset FileURL = #FORM.CurrentFile#>
  <cfset FileURL = 'None Assigned' />

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
mkishline, your first conditional statement should read
<cfif Form.FileUrl NEQ ""> NOT <cfif Form.FileUrl NEQ> correct?

As an added tip, when checking for a blank field it is usually a better practice to use the following:
<cfif Len(Trim(Form.FileUrl)) GT 0>

I believe this is because string content comparisons take slightly longer to process in the Java compiler than a simple string length does... but I'm not sure.  The one thing I know it does is prevent the accidental " " instead of "" being used. (I've done that to myself a couple of times before and I've seen dozens of examples that have done it as well).
It's always good to note that <cfif Len(Trim(form.fileurl)) GT 0> is long-hand for the more succinct (and fewer comparison operations) version <cfif NOT Len(Trim(form.fileurl))>.
Good point... although in Java (since that's actually what CF is) there shouldn't be a difference between a boolean NOT and a arithmatic GT or LT or EQ/NEQ for that matter.  Only multistep math comparisons would require an extra cycle (i.e. GTE or LTE).  

All basic math functions on any modern language should be one tick returns (+,-,*,/,<,>,=,!=,etc..)  Regardless you are correct about it being more succinct.  I don't know if you've had any experience with it, but I've also heard that contrary validations take 1 more cycle than agreeing validations (i.e. 'if NOT X' will take one tick more than 'if X').  Have you observed any difference in this?

However you made an error in your example (although your point is entirely valid).

<cfif Len(Trim(form.fileurl)) GT 0> is the same as <cfif Len(Trim(form.fileurl))>,
<cfif Len(Trim(form.fileurl)) EQ 0> is the same as <cfif NOT Len(Trim(form.fileurl))>.

Using <cfif Len(Trim(form.fileurl))> in this case is better than my example because it neither uses a NOT operator nor does it use an Arithmatic operator GT (although it still does in the compiled state because of the way CFIF is translated into java bytecode as far as I can tell).

Anyway, it's only going to matter on a very large application, and any of them will 'work' for you JHMOEN, but it's good to write tight code from the beginning because you never know.  I have one application that began as a simple document storage and retrieval system, but is now about 20K lines of code in 9 components and about 300 templates... If I'd known what kind of monster it would become I'd have definitely researched ways of optimizing code prior to starting... it's easier to start correctly than to have to retrofit something monstrous!

Good luck JHMOEN...
jhmoenAuthor Commented:
Increased the points, I would like to award all three of you for your insight.
This was great, and has shed some light on better ways of doing the same thing...which I appreciate.

Thanks mkishline, digicidal, and JeffHowden!
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.