Search code examples
laravel-5laravel-5.3

Laravel 5.3, How is file name generated?


In laravel 5.3 when we save the uploaded file to storage like in code below.

  $image = $request->file('image');
  $path = $image->store();

It gives us a path that includes a file name. How is that file name generated?

It is some kind of hash but what exactly? hash of server time during upload, hash of file contents or something else? Which hashing algorithm does it use?


Solution

  • The file name is generated by hashing the contents of the file using md5 algorithm in laravel 5.3

    I checked it by uploading a file to laravel 5.3 server and comparing the name it gives to a result given by an online md5 hash generator. But I haven't checked for other version of laravel.