# Str:slug on filenames

**URL:** <https://forum.getkirby.com/t/str-slug-on-filenames/29535>\
**Category:** Questions\
**Tags:** v3\
**Created:** [September 20, 2023, 9:10am UTC](https://forum.getkirby.com/t/str-slug-on-filenames/29535 "2023-09-20T09:10:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [September 20, 2023, 9:10am UTC](https://forum.getkirby.com/t/str-slug-on-filenames/29535/1 "2023-09-20T09:10:12Z")

</div>

Hi,

I am working on a site with lots of front-end file uploads, and have hit some difficulties with filenames causing issues in the panel. For example, if a user uploads this file:

`blank & something {{} [].pdf`

It gets saved to the content folder as:

`blank &amp; something {{} [].pdf`

Then when the client clicks on this in the Kirby panel there is the error message “ **The view could not be found** ”

I am now trying to use `Str::slug` to fix this (there may be a better way), so I can convert the filename to something better. However, when I do this it is also applying to the extension, so the file now looks like:

`blank-amp-something-pdf`

Which is no good.

What is the best way of sanitizing the filenames, while keeping the extension? Is it possible to get `Str::slug` to ignore ‘.’ characters?

Any help gratefully appreciated!

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 20, 2023, 9:27am UTC](https://forum.getkirby.com/t/str-slug-on-filenames/29535/2 "2023-09-20T09:27:03Z")

</div>

`F::safeName()`, see also [Uploading files from frontend | Kirby CMS](https://getkirby.com/docs/cookbook/forms/file-uploads)

---

<div class="post-metadata">

**Author:** ![mikeharrison](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mikeharrison/32/9620_2.png) [@mikeharrison](https://forum.getkirby.com/u/mikeharrison)\
**Post date:** [September 20, 2023, 4:26pm UTC](https://forum.getkirby.com/t/str-slug-on-filenames/29535/3 "2023-09-20T16:26:14Z")

</div>

Super, that was just the thing. Thank you!
