Jump to content

Renaming Uploaded Files


Mzor

Recommended Posts

try using strrchr :)

 

$file = md5(microtime(true)) . strtolower(strrchr($_$FILES['file']['name'],'.'));

 

but ya may want to validate a proper extension maybe a pregmatch only dots and alpha num

if(!preg_match('@^[\w.-=]+$@',$_FILES['file']['name'])
  die('Bad Filename');

 

well ya gets the picture :)

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.