PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP_Upload » Bug #4180

append in Upload::setName destroys the filename

Details

Submitted2005-04-19 14:40 UTC
Fromlw at synpro-digital dot de
StatusNo Feedback
PackageHTTP_Upload
PHP Version4.3.11
OSfc3
Roadmaps(Not assigned)

Comments

[2005-04-19 14:40 UTC] lw at synpro-digital dot de

Description:
------------
Version: HTTP_Upload 0.9.1 stable

Upload::setName (using $mode 'safe') will set the $append parameter at the end of the real name! so the uploaded file will get a extension wich is the realextension plus the append parameter, see:

Reproduce code:
---------------
// prepend in the filename:
$prepend = 'u' . $_SESSION['account']['uid'];

// append in the filename (a unique number):
srand((double) microtime() * 1000000);
$append = uniqid(rand());

// [...]
$file->setName('safe',$prepend,$append);
//[...]

Expected result:
----------------
/*
will generate a filename like this:
u12345myfilename.jpg17638203514265135e2f258

but it should be:
u12345myfilename17638203514265135e2f258.jpg
*/

[2005-04-19 17:58 UTC] lw at synpro-digital dot de

Yes, off course! :)

Check this: http://www.public.rock-n-roll-superstar.com/PEAR_Bug_4180.phps