Urlencoding function added for dealing with file names with spaces and special chars