Skip to content

Instantly share code, notes, and snippets.

@jasonvarga
Created July 19, 2017 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonvarga/996caf5f9a1199eba88fc4c5200ea2d9 to your computer and use it in GitHub Desktop.
Save jasonvarga/996caf5f9a1199eba88fc4c5200ea2d9 to your computer and use it in GitHub Desktop.
<?php
// line 6
use Stringy\Stringy;
// line 472
public function upload(UploadedFile $file)
{
$ext = $file->getClientOriginalExtension();
$filename = $this->getSafeFilename(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));
$basename = $filename . '.' . $ext;
// line ~499
private function getSafeFilename($string)
{
return (string) Stringy::create($string)->toAscii()->replace(' ', '-');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment