It looks to me like the upload form is badly nested inside of another form, hard to tell without running the code, but it would explain the error you are getting.
before submitting the form, view source an the page and make sure that the upload form is not nested inside of another form.