Re: File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name']

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/12/22 Andrei Iarus <poni1111@xxxxxxxxx>:
> Hello,
>
> On my production & testing servers (production runs on a centrino and testing runs on Windows) I can only access the temporary uploaded file using
> ini_get( 'upload_tmp_dir' . '/' . $_FILES['filename']['name'];
> while the file $_FILES['filename']['tmp_name'] simply does not exist (checked with file_exists() function, and also looking in the temporary folder).
>
> Is there a problem with my PHP installations? Is there any directive to change this bihaviour?
>
> On production: PHP 5.2.10 and on testing: PHP 5.2.8 and 5.3.0
>
> Thanks in advance.
>
>
>

2 functions to get to grips with:

1 - is_uploaded_file()
2 - move_uploaded_file()

Example from http://php.net/is_uploaded_file

<?php

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
   echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n";
   echo "Displaying contents\n";
   readfile($_FILES['userfile']['tmp_name']);
} else {
   echo "Possible file upload attack: ";
   echo "filename '". $_FILES['userfile']['tmp_name'] . "'.";
}

?>


-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux