0

i'm in trouble this is an example of $_FILES['file']['tmp_name']

/Applications/XAMPP/xamppfiles/temp/phpjCag18 

i would like to get the temp binary filename so in this case phpjCag18

Is there anyway to get it from the $_FILES[]?

Ho to get it clean from path ?

000
  • 26,951
  • 10
  • 71
  • 101
itsme
  • 48,972
  • 96
  • 224
  • 345

2 Answers2

4

You can use basename() for this purpose.

$tmp = $_FILES['file']['tmp_name'];
echo basename( $tmp );

Or, if you're trying to get the extension, use pathinfo():

$extension =  strtolower( pathinfo($_FILES['file']['tmp_name'], PATHINFO_EXTENSION) );
Amal Murali
  • 75,622
  • 18
  • 128
  • 150
  • thanks just accepted the other's answer cause he was just faster :P thanks a lot for explanation +1 – itsme Jul 15 '13 at 10:40
2

If I understand you correctly:

basename($_FILES['file']['tmp_name'])
rr-
  • 14,303
  • 6
  • 45
  • 67