How can I remove empty spaces form a file name when uploading to the server?
Here is the code I'm currently using which grabs the file's original name and saves it into hard disc (
$file = request()->file('imageFile'); $fileName = $file->getClientOriginalName(); $file->storeAs('images/', $fileName);
I know I could use the following code which automatically generates a hash name but I need to capture the name to be able to save it in a database and I'm not sure if using this method would be possible to get the auto generated hash name.
Again, how can I remove any empty space form a file?
For instance, change
my file name.jpg to