lkrubner
asked on
The file input in my form is not showing up when I submit the form
I've this form on one of my pages. Note that the name for the "file" input is the same as any other:
<form method="post" action="profile.php?id=5&f ormName=my _story_edi t.htm" enctype="multipart/form-da ta">
<p>My story:<br />
<textarea name="totalFormInputs[user s][5][desc ription]"> I grew up in New Jersey. </textarea></p>
<p>Email address:<br />
<input type="text" name="totalFormInputs[user s][5][emai l_address] " value="lawrence@krubner.co m" /></p>
<p>Zip code:<br />
<input type="text" name="totalFormInputs[user s][5][zip_ code]" value="22902" /></p>
<p>Personal image:<br />
<input type="file" name="totalFormInputs[user s][5][uplo ad_file]" /></p>
<input type="submit" value="Update" />
<input type="hidden" name="choiceMade[]" value="createRecordsForMul tipleDatab aseTables" />
<input type="hidden" name="totalFormInputs[user s][5][time ]" value="1187380627" />
</form>
When this form submits, it triggers the function "createRecordsForMultipleD atabaseTab les". At the top of that I get the variable $totalFormInputs. If I feed that to print_r(), I find that the "file" input has mysteriously disappeared:
Array
(
[users] => Array
(
[5] => Array
(
[description] => I grew up in New Jersey. I started drinking when I was 12. I stopped when I was 32.
[email_address] => lawrence@krubner.com
[zip_code] => 22902
[time] => 1187380627
)
)
)
Why is this happening? Where did it go?
I had this script working for a year. There have been some changes to the server, but none that I think would effect this.
Actually, this script is still working in most ways. The array tells the code to update record 5 in the MySql table "users". That part works fine.
But where is the file input info?
I keep choosing different images, but nothing shows up. I've used both Macs, Windows and Ubuntu Linux to test this form.
<form method="post" action="profile.php?id=5&f
<p>My story:<br />
<textarea name="totalFormInputs[user
<p>Email address:<br />
<input type="text" name="totalFormInputs[user
<p>Zip code:<br />
<input type="text" name="totalFormInputs[user
<p>Personal image:<br />
<input type="file" name="totalFormInputs[user
<input type="submit" value="Update" />
<input type="hidden" name="choiceMade[]" value="createRecordsForMul
<input type="hidden" name="totalFormInputs[user
</form>
When this form submits, it triggers the function "createRecordsForMultipleD
Array
(
[users] => Array
(
[5] => Array
(
[description] => I grew up in New Jersey. I started drinking when I was 12. I stopped when I was 32.
[email_address] => lawrence@krubner.com
[zip_code] => 22902
[time] => 1187380627
)
)
)
Why is this happening? Where did it go?
I had this script working for a year. There have been some changes to the server, but none that I think would effect this.
Actually, this script is still working in most ways. The array tells the code to update record 5 in the MySql table "users". That part works fine.
But where is the file input info?
I keep choosing different images, but nothing shows up. I've used both Macs, Windows and Ubuntu Linux to test this form.
ASKER
It's bizzare. I'm getting the right results in $_FILES, but not in $_POST. If I do print_r($_FILES) I get this:
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 looks right to me. Yet if I do print_r($_POST), then upload_file is mysteriously missing from totalFormInputs.
How is that possible?
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 looks right to me. Yet if I do print_r($_POST), then upload_file is mysteriously missing from totalFormInputs.
How is that possible?
Hi
i had look at your page. i am selecting one image and click update button. that display the uploaded file details at top.
Array ( [totalFormInputs] => Array ( [name] => Array ( [users] => Array ( [5] => Array ( [upload_file] => 3.jpg ) ) ) [type] => Array ( [users] => Array ( [5] => Array ( [upload_file] => image/pjpeg ) ) ) [tmp_name] => Array ( [users] => Array ( [5] => Array ( [upload_file] => /tmp/phpWIcM7x ) ) ) [error] => Array ( [users] => Array ( [5] => Array ( [upload_file] => 0 ) ) ) [size] => Array ( [users] => Array ( [5] => Array ( [upload_file] => 190390 ) ) ) ) ) Array ( [users] => Array ( [5] => Array ( [description] => I grew up in New Jersey. I started drinking when I was 12. I stopped when I was 32. [email_address] => lawrence@krubner.com [zip_code] => 22902 [time] => 1187380627 ) ) )
i hope you won't fill the filename/filepath to file control. instead of that you can show the current image just above the file control line. so the user can see the uploaded images and they can update the images in future.
Actually, what do you need from this? if you have any doubt in this, please explain little bit more.
Regards,
M.Raja
i had look at your page. i am selecting one image and click update button. that display the uploaded file details at top.
Array ( [totalFormInputs] => Array ( [name] => Array ( [users] => Array ( [5] => Array ( [upload_file] => 3.jpg ) ) ) [type] => Array ( [users] => Array ( [5] => Array ( [upload_file] => image/pjpeg ) ) ) [tmp_name] => Array ( [users] => Array ( [5] => Array ( [upload_file] => /tmp/phpWIcM7x ) ) ) [error] => Array ( [users] => Array ( [5] => Array ( [upload_file] => 0 ) ) ) [size] => Array ( [users] => Array ( [5] => Array ( [upload_file] => 190390 ) ) ) ) ) Array ( [users] => Array ( [5] => Array ( [description] => I grew up in New Jersey. I started drinking when I was 12. I stopped when I was 32. [email_address] => lawrence@krubner.com [zip_code] => 22902 [time] => 1187380627 ) ) )
i hope you won't fill the filename/filepath to file control. instead of that you can show the current image just above the file control line. so the user can see the uploaded images and they can update the images in future.
Actually, what do you need from this? if you have any doubt in this, please explain little bit more.
Regards,
M.Raja
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Apparently in PHP 5 a file upload no longer shows up in $_POST. It only shows up in $_FILES. This change broke my code. My upload script has worked for years, under PHP 4, but it no longer works.
ASKER
http://www.bluewalldev.com/secondroad/profile.php?id=5&formName=my_story_edit.htm
I apologize the site is so rough. We are at an early point of construction.