473,320 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Empty $_FILES array??!?!

Can someone else see immediately why this script:

<html>
<body>
<?php
error_reporting(~E_ALL);
print_r($_FILES);

print_r($_POST);

print_r($_REQUEST);

?>
<form name="form" action="<?php echo $_SERVER['PHP_SELF'] .
'?processed=1'; ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<input type="file" enctype="multipart/form-data" name="thefile"/>
<input type="submit"/>
</form>
</body>
</html>
Causes this output:

Array
(
)
Array
(
[MAX_FILE_SIZE] => 5000000
[thefile] => archivedir.sh
)
Array
(
[processed] => 1
[MAX_FILE_SIZE] => 5000000
[thefile] => archivedir.sh
[PHPSESSID] => e7aa5c556db6b286a8eca8704b58a4de
)

When file_uploads, upload_max_filesize, upload_tmp_dir, post_max_size
and max_input_time are set to appropriate values in php.ini (php5.1.2)?
Driving me nutso.

Apr 6 '06 #1
2 3694
"chris" <cf*******@gmail.com> wrote in message
news:11*********************@j33g2000cwa.googlegro ups.com...
Can someone else see immediately why this script:

<html>
<body>
<?php
error_reporting(~E_ALL);
print_r($_FILES);

print_r($_POST);

print_r($_REQUEST);

?>
<form name="form" action="<?php echo $_SERVER['PHP_SELF'] .
'?processed=1'; ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<input type="file" enctype="multipart/form-data" name="thefile"/>
<input type="submit"/>
</form>
</body>
</html>


The enctype="multipart/form-data" is supposed to be an attribute of the
form, not the file field.

Like so:
<form name="form" action="<?php echo $_SERVER['PHP_SELF'] .
'?processed=1'; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<input type="file" name="thefile"/>
<input type="submit"/>
</form>

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Apr 6 '06 #2
D'oh. Thank you.

Apr 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mrbog | last post by:
All I did was recompile my PHP 4.3.4 with the included GD and now my $_FILES is perpetually empty. My php app is identical, I haven't changed it at all since recompiling. I tried recompiling...
6
by: lawrence | last post by:
I've the form you see below, which is supposed to upload an image. I expect the image name as a var to be $uploadedFile. In the receiving function, I've this code: global $uploadedFile,...
4
by: Ian.H | last post by:
Hi all, Uploading of files.. AFAIU from the manual, if a file is larger than the size defined in the form or larger than upload_max_filesize in php.ini, that _FILES should hold an INT error...
1
by: Bob Bedford | last post by:
I've a function asking for a $_FILES argument: function insertarticle($particle,......,$pUserID,$pOptions,$files){ in this function I do add the record and then save the files in a subdirectory...
3
by: Bob Bedford | last post by:
I'm passing the code from $_POST to $_GET. I've a page upload using $_FILES. when the page was in $_POST, it worked fine, but now, in $_GET, the $_FILES is empty. any idea ?
8
by: mpar612 | last post by:
Hello, I am a newbie to PHP, MySQL. I am trying to create a basic file upload form. I want to get that working and then I want to integrate that into a form that will rename the file and save...
9
by: Arthur Jacobs | last post by:
Good Day, I can upload a file as long as it is empty (thanks Hendri Kurniawan). I do not know where to look. Can someone help me understand what I need to do to upload a small image....
2
by: daav31 | last post by:
Hello, I have the following code: $RecordID = $_POST; $LastModBy= $_POST; // These datetime vars live in globals.php $mySQLToday = $thisYear.'-'.$thisMonth.'-'.$thisDay; // prints...
3
Markus
by: Markus | last post by:
Ok, so i'm doing the multiple file upload thingymabob! I'm just playing around really... When i try to check the file type i simply get Array(). foreach ($_FILES as $_key => $_value) {...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.