I have my upload php code where my intent is , obtained file from $_files
,
add a random number between 0 and 9999 to the name of image like this:
image sent
: image.jpg before saving
: image321.jpg
the image is saved in my upload folder but the filename are like "php2983204tmp"
if ($file !== null) {
$rand = rand(0000,9999);
$path = "some_path";
$file_name = $file->getClientOriginalName(); // file
$extension = $file->getClientOriginalExtension(); // jpg
$file->move($path, $file_name.$rand.$extension);
$response = "File loaded successfully: " . $file_name.$extension;
$response .= '<br>size: ' . filesize($path . '/' . $file->getClientOriginalName()) / 1024 . ' kb';
return new Response($response);
any ideas to fix?