Picture upload and original names #1869
Replies: 3 comments 1 reply
-
Hi 👋 Of course. You can control this by implementing your own behavior class. You can find it in the config here Line 146 in 5351818 |
Beta Was this translation helpful? Give feedback.
-
Thanks so much, works. My question now is this: the generator is applied globally, suppose if i want load the images on the folder media/images and the document on the folder media/documents. Is possibile set different location for the screen ? Thanks |
Beta Was this translation helpful? Give feedback.
-
@tabuna would be good to be able to create sub-folders for each group automatically without creating a new filesystem for each group. What do you think? I can make a PR if you are interested. Checking in source code we could pass the group name when creating a new instance of generator, something like: // In Orchid\Attachment\File
$this->engine = new $generator($file, $group);
// In Orchid\Attachment\Engines
/**
* @var string
*/
protected $group;
public function __construct(UploadedFile $file, string $group = '')
{
// ...
$this->group = $group;
}
public function path(): string
{
return ltrim($this->group . '/' . date('Y/m/d', $this->time()), '/');
} For avoid BC could be added a new config that enable/disable this feature, by default disabled. Would be then enough to disable it by checking config in constructor of Generator before set As seem to me that it's not possible to do this by just creating custom generator, since has not access to group. What do you think? |
Beta Was this translation helpful? Give feedback.
-
Hello, i would ask if is possible configure upload for mantain the original file name. I need to upload the image mantaining the original name and not upload with generated file name. Thanks
Beta Was this translation helpful? Give feedback.
All reactions