0

I'm having a weird problem with file uploads with Apache/PHP 5.3 on a SLES 11 SP2 When I try to upload a file PHP only pick up the files original name ($_FILES['name']), and not all the other vars I need.

I have checked and double cheched my php.ini both for upload max file, put max size, file upload enabled etc.

Does anybody have an idea what is going on?

Here is the script I used to test it:

<?php
if(isset($_FILES)) {
    var_dump($_FILES);
}
?>
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="/" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <!-- Name of input element determines name in $_FILES array -->
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />
</form>

And this is what I receive:

array(1) { ["userfile"]=> array(1) { ["name"]=> string(8) "test.txt" } }
andr
  • 15,970
  • 10
  • 45
  • 59
Shabbir
  • 11
  • 3

3 Answers3

1

I had issue with $_FILES. It didnt upload any files.

I upgraded php components from 5.3.8-0.19.6 to 5.3.8-0.33.2 and worked...

See this post

Djomla
  • 620
  • 2
  • 7
  • 18
0

Could be an issue writing the uploaded file to the tmp dir. What does upload_tmp_dir say in phpinfo()?

EDIT:

I see No value for upload_tmp_dir. It may default to /tmp, but I would explicitly set it to /tmp in php.ini and check that you have set the permissions appropriately. Setting error_reporting to On in conjunction with looking at your Apache logs would helpful in troubleshooting. Since you don't have server access, you could try this directly in your php script:

ini_set('upload_tmp_dir', '/tmp')
error_reporting(E_ALL);
ini_set('display_errors', '1');
Banjer
  • 8,118
  • 5
  • 46
  • 61
  • The upload_tmp_dir says '/tmp' and the folder is there .Here is the link for phpinfo http://173.14.125.3/sourcefirst/php_info.php – Shabbir May 22 '12 at 11:22
  • This is the output i get when i print_r the $_FILE variable, i have also added the code you sent me Array ( [uploaded_cv] => Array ( [name] => changes11.doc ) ) – Shabbir May 22 '12 at 11:54
0

We had the same issue with PHP upload in SLES 11 SP2. In our case the /tmp folder limit was max out.

Try df -h command to see if you need some cleaning.

andr
  • 15,970
  • 10
  • 45
  • 59