Magento – Image Upload in Admin Panel

admin-panelimagevarien-file-uploader

I am developing a custom module. In this regard I have to upload image in admin panel. I found below codes in some tutorial.

$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
$uploader->setAllowCreateFolders(true); 

I would like to know more about these lines. What do they mean ??

Best Answer

  • $uploader->setAllowRenameFiles(true); //if true, uploaded file's name will be changed, if file with the same name already exists directory. Necessary to avoid conflicts

  • $uploader->setFilesDispersion(false); //To have a dispersion based on the original file name (as the file option does), we will have to do it manually

  • $uploader->setAllowCreateFolders(true); //for creating the directory if not exists

Related Topic