usually translated to characters as well we can often get away without manually translating most non-ascii characters when sending paths explicitly (in typed urlsbut as we saw earlierwe sometimes need to be careful to escape characters ( &that have special meaning within url strings with urllib parse tools handling client path formats in the endthe putfile py script stores the uploaded file on the server within hardcoded uploaddir directoryunder the filename at the end of the file' path on the client ( less its client-side directory pathnoticethoughthat the splitpath function in this script needs to do extra work to extract the base name of the file on the right some browsers may send up the filename in the directory path format used on the client machinethis path format may not be the same as that used on the server where the cgi script runs this can vary per browserbut it should be addressed for portability the standard way to split up pathsos path splitknows how to extract the base namebut only recognizes path separator characters used on the platform on which it is running that isif we run this cgi script on unix machineos path split chops up paths around separator if user uploads from dos or windows machinehoweverthe separator in the passed filename is \not browsers running on some macintosh platforms may send path that is more different still to handle client paths genericallythis script imports platform-specific path-processing modules from the python library for each client it wishes to supportand tries to split the path with each until filename on the right is found for instanceposixpath handles paths sent from unix-style platformsand ntpath recognizes dos and windows client paths we usually don' import these modules directly since os path split is automatically loaded with the correct one for the underlying platformbut in this casewe server-side scripting