Skip to content

setName() doesn't set the name for uploaded file #141

@ghost

Description

Hello,

first of all: Thank you for you great work on that image uploader!

When uploading a file it gets a random name even when using setName() function.

My current workaround is to uncomment line 405:
$this->setName() call inside constraintValidator()

because setName() seems to be called twice then wich seems to load the function again with an empty name parameter.
I Also had to use just this line

$this->name = filter_var($isNameProvided, FILTER_SANITIZE_FULL_SPECIAL_CHARS);

instead of :

if ($isNameProvided) {
        $this->name = $isNameProvided;
      }else{
        $this->name = uniqid('', true) . '_' . str_shuffle(implode(range('e', 'q')));
      }
return $this;

Now the name is set but I think you will find a better solution for that.

Kind regards.

EDIT:
Calling setName function in constraintValidator-funktion like this (with name parameter):
$this->setName($this->name);

seems to work aswell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions