$_FILES seems to be empty??

Discussion in 'PHP' started by 123GoToAndPlay, May 12, 2009.

  1. #1
    Hi,

    trying to create a simple .pdf upload form
    
    
    <form action="" enctype="multipart/form-data" method="post">
       File name:<br /> <input type="text" name="name" value="" /><br />
       PDF file:<br /> <input type="file" name="pdffile" value="" /><br />
       <p><input type="submit" name="submit" value="submit" /></p>
    </form>
    
    PHP:
    but print_r($_FILES) seems to be empty, $_POST['name'] is good;
    
    if(isset($_POST['submit'])) {
    	echo $_POST['name']."<br>";
    	print_r($_FILES)."<br>";
    etc
    
    PHP:
    i have chmod 777 the dir where .pdf should be uploaded

    i am using phpversion 4.4.2

    any tips?

    ps: how can i check if file uploads is turned on? As this server config have phpinfo() disabled???
    even
    
     ini_get('file_uploads')
    
    PHP:
    gives nothing. Should be 0 or 1, right?

    ps2: i tried to get access to conf folder to add
    
    <Directory "/some/dir">
    php_admin_flag file_uploads on
    php_value upload_max_filesize 4M
    </Directory>
    
    
    PHP:
    Unfortunatly, i haven't got the permission :(
     
    123GoToAndPlay, May 12, 2009 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    try to contact your hosting provider, it's not a php fault! ;)
     
    EricBruggema, May 12, 2009 IP
  3. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    While you're at it , upgrade to PHP5 already. It's been over 5 years that PHP5 has been the current version of PHP.
     
    kblessinggr, May 12, 2009 IP
  4. austin-G

    austin-G Peon

    Messages:
    435
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It's possible that your <form> is inside another <form>, causing it not to work. This is a common error when working with $_FILES.
     
    austin-G, May 12, 2009 IP
  5. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #5
    I think $_FILES is not compatible to php4.. upgrade to php 5, thats the best you can do
     
    bartolay13, May 13, 2009 IP
  6. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Alternatively there is $HTTP_POST_FILES['name'] (or 'tmp_name' and so forth) for the older PHP versions.
     
    kblessinggr, May 13, 2009 IP
  7. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #7
    yap if i can remember thats $HTTP_POST_FILES.. +1 there blessinggr
     
    bartolay13, May 13, 2009 IP
  8. atlantaazfinest

    atlantaazfinest Peon

    Messages:
    389
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    lol $_FILES is php4 compatible.

    try changing isset() to if($_POST)
     
    atlantaazfinest, May 13, 2009 IP