change the location of attached files to the public/files directory
updated version