Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Oct 27, 2023 · 1 comment
Closed

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

ghost opened this issue Oct 27, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 27, 2023

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.

samayo added a commit that referenced this issue May 5, 2024
@samayo
Copy link
Owner

samayo commented May 5, 2024

thanks, sorry for taking a long time

@samayo samayo closed this as completed May 5, 2024
samayo added a commit that referenced this issue May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant