Skip to content

Instantly share code, notes, and snippets.

@leonardopinho
Created November 14, 2018 17:52
Show Gist options
  • Save leonardopinho/e32a67112098eb077ea80967d88d74fc to your computer and use it in GitHub Desktop.
Save leonardopinho/e32a67112098eb077ea80967d88d74fc to your computer and use it in GitHub Desktop.
/**
* saveOriginalPhoto
* @param Request $request
* @param $sub_path
* @return string
*/
public static function saveOriginalPhoto(Request $request, $sub_path)
{
$File = $request->file('image');
$real_name = md5(rand(11111, 99999)) . '_' . time() . '.jpg';
$destination_path = public_path($sub_path);
$res = $File->move($destination_path, $real_name);
return $sub_path . '/' . $res->getFileName();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment