NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Form handling with mutipart/form-data

soazine@pop.erols.com soazine at pop.mail.rcn.net
Tue Sep 3 12:05:58 EDT 2002


Well that is partially convenient.  If I have <input type=file name=myFile>
how would I obtain the actual file name, file size, content-type and the
file contents while simply using $_POST?

Phil

Original Message:
-----------------
From: The RainMan rainman at deroo.net
Date: Tue,  3 Sep 2002 09:29:50 -0400
To: talk at nyphp.org
Subject: Re: [nycphp-talk] PHP Form handling with mutipart/form-data


Phil--

>I know that PHP uses $HTTP_FORM_VARS associative array variable (or $FORM
>too I think I forget),


Actually $HTTP_*_VARS has been deprecated, although still available. The 
preferred way is to use $_POST, $_GET, $_REQUEST, as necessary.

>however, can PHP use these variables if the form submitted was of type 
>multipart/form-data?

Sure, not a problem. Any time I need to deal with file uploads I use 
multipart/form-data, works just  the same.

>E.g.
>
><form method=post action=blah.php enctype=multipart/form-data>
>..
><input type=file name=file>
>..
></form>
>
>How would PHP handle a form such as this, where you would be uploading
>files?

Just as it does any other form. For an in depth look on dealing with file 
uploads check out http://www.php.net/manual/en/features.file-upload.php

r



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .






More information about the talk mailing list