|
Posted by Jerry Stuckle on 08/23/07 12:55
lawrence k wrote:
> On Aug 23, 12:05 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> lawrence k wrote:
>>> On Aug 22, 11:48 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>> lawrence k wrote:
>>>>> I've a form that starts off like this:
>>>>> <form method="post" action="profile.php?
>>>>> id=5&formName=my_story_edit.htm" enctype="multipart/form-data">
>>>>> <p>Email address:<br />
>>>>> <input type="text" name="totalFormInputs[users][5][email_address]"
>>>>> value="lawre...@krubner.com" /></p>
>>>>> <p>Zip code:<br />
>>>>> <input type="text" name="totalFormInputs[users][5][zip_code]"
>>>>> value="22902" /></p>
>>>>> <p>Personal image:<br />
>>>>> <input type="file" name="totalFormInputs[users][5][upload_file]" /></
>>>>> p>
>>>>> Oddly enough, the "upload_file" has suddenly disappeared from the
>>>>> uploaded array. When I hit $totalFormInputs with print_r, this is what
>>>>> I get:
>>>>> Array
>>>>> (
>>>>> [users] => Array
>>>>> (
>>>>> [5] => Array
>>>>> (
>>>>> [description] => I grew up in New Jersey.
>>>>> [email_address] => lawre...@krubner.com
>>>>> [zip_code] => 22902
>>>>> [time] => 1187380627
>>>>> )
>>>>> )
>>>>> )
>>>>> Why is the file input not show up?
>>>>> Everything was working fine a month ago, and now it is broke.
>>>>> Any help is very much appreciated.
>>>> Nothing entered into the field? If it's empty, nothing will be returned.
>>>> What does print_r($_POST) show?
>>> Good question.
>>> print_r($_POST) gives me this:
>>> Array
>>> (
>>> [totalFormInputs] => Array
>>> (
>>> [users] => Array
>>> (
>>> [5] => Array
>>> (
>>> [description] => I grew up in New Jersey.
>>> [email_address] => lawre...@krubner.com
>>> [zip_code] => 22902
>>> [time] => 1187380627
>>> )
>>> )
>>> )
>>> [day] => 05
>>> [month] => 07
>>> [year] => 2006
>>> [choiceMade] => Array
>>> (
>>> [0] => createRecordsForMultipleDatabaseTables
>>> )
>>> )
>>> I click the browse button (by the "file" input) and choose a JPEG
>>> called "car_derby.jpg". But it doesn't show up in POST.
>>> Why?
>> Are you sure the field is still within the form? Or did you perhaps
>> move the </form> back too far?
>>
>> Does the HTML validate?
>>
>> If the HTML is correct, it should show up in the $_POST variable. But
>> since it isn't, you have an HTML problem - not a PHP one.
>
> This is what I get if I do print_r($_FILES):
>
> Array
> (
> [totalFormInputs] => Array
> (
> [name] => Array
> (
> [users] => Array
> (
> [5] => Array
> (
> [upload_file] => car_derby.jpg
> )
>
> )
>
> )
>
> [type] => Array
> (
> [users] => Array
> (
> [5] => Array
> (
> [upload_file] => image/jpeg
> )
>
> )
>
> )
>
> [tmp_name] => Array
> (
> [users] => Array
> (
> [5] => Array
> (
> [upload_file] => /tmp/phpiBxJrN
> )
>
> )
>
> )
>
> [error] => Array
> (
> [users] => Array
> (
> [5] => Array
> (
> [upload_file] => 0
> )
>
> )
>
> )
>
> [size] => Array
> (
> [users] => Array
> (
> [5] => Array
> (
> [upload_file] => 32302
> )
>
> )
>
> )
>
> )
>
> )
>
>
>
>
> That's what I would expect. It's bizzare, I get the right results in
> $_FILES, but not in $_POST. How is that possible?
>
>
>
>
>
>
>
That's right... I shouldn't try to answer at midnight after I've been
out with the guys... :-)
Yes, it goes in the $_FILES array, not $_POST.
Once I got some sleep and looked at this again this morning, it was
obvious :-). Sorry to steer you down the wrong path.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|