[thelist] OO PHP

Beau Hartshorne beau at members.evolt.org
Tue Feb 12 18:40:12 CST 2002


Hi,

I am trying to write a "FormInputFile" ojbect in PHP. So far, this
object prints the proper html code for a form input element. After some
file has been uploaded, I'd like the object to check the uploaded
filesize, check the uploaded file type, then store the uploaded file in
some directory.

I want a function in the object to check to see if a file has been
uploaded. To do this, I wanted the object to check $HTTP_POST_FILES on
its own. If I do this, I get this error/warning:

Warning: Undefined variable: HTTP_POST_FILES

I get the error because the FormInputFile.php script (which contains my
FormInputFile class) cannot get the HTTP_POST_FILES information from the
script which instantiates the object.

So I upgraded to php 4.1.1 (on my dev machine), and used the new $_FILES
variable. This variable has a broader scope and works fine, but my ISP
is reluctant to upgrade to the newest version of PHP. Is there another
way to have the object be aware of the stuff uploaded in a form? Is
there a better way? Should I just ditch trying to do OO PHP?

Thank you,

Beau




More information about the thelist mailing list