Symfony World blog is not maintained anymore. Check new sys.exit() programming blog.

symfony file upload - leave original file name

If you want your uploaded files to stay with the original file name (which is not randomly generated by symfony), just add following lines to the model class you want to upload files:

public function generateXxxFileName($file)
  return $file->getOriginalName();

where Xxx is the name of the column that stores the filename in the database model related table.

1 comment:

  1. In Symfony 2.3, now changed to $file->getClientOriginalName()