uploaded file custom filename

uploaded file custom filename

calacala Posts: 52Questions: 15Answers: 0
edited September 2015 in Free community support

Hi everybody!

as in the example:

Field::inst( 'image' )
    ->upload( Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' ) )
    ->setFormatter( 'Format::nullEmpty' );

is it possible to recover the original filename (or a md5 hash of it) and use it in place of the id?

I tried:

Field::inst( 'image' )
    ->upload( 
    Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/'.hash('md5', Upload::DB_FILE_NAME).'.__EXTN__' )

but it always call the file with the hash of "editor-fileName" string.

I don't wanna use a custom function because I need the save path...

Thanks for the help.

This discussion has been closed.