RE: [PHP] multipart/form-data and Array POST
| From: | Andy Lewis | Date: | Sat, 13 Mar 2004 16:14:16 +0000 |
| Subject: | RE: [PHP] multipart/form-data and Array POST | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180340@lists.php.net to get a copy of this message | ||
I am running:
$my_array = unserialize(base64_decode($my_array));
on the array once it's POSTed.
-----Original Message-----
From: Raditha Dissanayake [mailto:jabber@raditha.com]
Sent: Saturday, March 13, 2004 10:18 AM
To: Andy Lewis
Cc: php-general@lists.php.net
Subject: Re: [PHP] multipart/form-data and Array POST
Andy Lewis wrote:
>Hello All,
>
>I'm having a problem including an array in a hidden field for file
>upload.
>
>My first question is, can this be done? Can I actually include an array
>in a hidden field on a POSTed PHP upload field?
>
>
can be done
>
>If so do I have to encode the array. I use array's on my site and am
>aware that I have to encode them to pass the values from page to page
>but, for some reason I can't pass them thru a multipart/form-data form
>upload. The file gets uploaded with no problem.
>
>
You are posting to $PHP_SELF, are you sure you are not clobbering your
$my_array variable before you attempt to retrieve it's value? What is
your register globals settings?
>
>
>My Code:
>
><form action="<?=$PHP_SELF?>" method="POST" name="sendit"
>
>enctype="multipart/form-data"> <input name="<?= $upload_file_name;
>?>"
>type="file" size="60"> <input type="submit"
>value="Upload">
><?
>echo "<input type=\"hidden" name=\"my_array\" value=\"" .
>base64_encode(serialize($my_array)) . "\">";
>?>
></form>
>
>
The code does not compile.
--
Raditha Dissanayake.
---------------------------------------------------------------
http://www.radinks.com/upload/
Drag and Drop Upload thousands of files and folders in a single
transfer. (HTTP or FTP)