Use uniqid() instead of random_bytes()
This commit is contained in:
parent
633da5406b
commit
91fb30ed40
1 changed files with 3 additions and 3 deletions
|
@ -50,7 +50,7 @@ class OfferController extends AbstractController
|
||||||
$offer->setCreatedAt(new \DateTime());
|
$offer->setCreatedAt(new \DateTime());
|
||||||
|
|
||||||
if ($photo = $form['photo']->getData()) {
|
if ($photo = $form['photo']->getData()) {
|
||||||
$filename = bin2hex(random_bytes(6)).'.'.$photo->guessExtension();
|
$filename = uniqid().'.'.$photo->guessExtension();
|
||||||
try {
|
try {
|
||||||
$photo->move($photoDir, $filename);
|
$photo->move($photoDir, $filename);
|
||||||
} catch (FileException $e) {
|
} catch (FileException $e) {
|
||||||
|
@ -113,7 +113,7 @@ class OfferController extends AbstractController
|
||||||
$offer->setCreatedAt(new \DateTime());
|
$offer->setCreatedAt(new \DateTime());
|
||||||
|
|
||||||
if ($photo = $form['photo']->getData()) {
|
if ($photo = $form['photo']->getData()) {
|
||||||
$filename = bin2hex(random_bytes(6)).'.'.$photo->guessExtension();
|
$filename = uniqid(random_bytes(6)).'.'.$photo->guessExtension();
|
||||||
try {
|
try {
|
||||||
$photo->move($photoDir, $filename);
|
$photo->move($photoDir, $filename);
|
||||||
} catch (FileException $e) {
|
} catch (FileException $e) {
|
||||||
|
|
Reference in a new issue