Check if file exists and remove invalid chars

Note: 
I don't know if my regex ('/[^A-Za-z0-9\-]/') will also keep the . (dot) in the filename