for path in privatesif samefile(pathfilename)return true unify all paths by os stat else returns none=false tryform cgi fieldstorage(filename form['filename'value exceptfilename 'cgi-bin\getfile pyurl param or form field else default filename tryassert not restricted(filenameload unless private filetext open(filenameread(platform unicode encoding except assertionerrorfiletext '(file access denied)exceptfiletext '(error opening file% )sys exc_info()[ if not formattedprint('content-typetext/plain\ 'send plain text print(filetextworks on nsnot ieelseprint('content-typetext/html\ 'wrap up in html print(html (filenamecgi escape(filetext))this python server-side script simply extracts the filename from the parsed cgi inputs object and reads and prints the text of the file to send it to the client browser depending on the formatted global variable settingit sends the file in either plain text mode (using text/plain in the response headeror wrapped up in an html page definition (texthtmlboth modes (and otherswork in general under most browsersbut internet explorer doesn' handle the plain text mode as gracefully as netscape does--during testingit popped up the notepad text editor to view the downloaded textbut end-of-line characters in unix format made the file appear as one long line (netscape instead displays the text correctly in the body of the response web page itself html display mode works more portably with current browsers more on this script' restricted file logic in moment let' launch this script by typing its url at the top of browseralong with desired filename appended after the script' name figure - shows the page we get by visiting the following url (the second source link in the language selector page of example - has similar effect but different file)the body of this page shows the text of the server-side file whose name we passed at the end of the urlonce it arriveswe can view its textcut-and-paste to save it in file on the clientand so on in factnow that we have this generalized source code server-side scripting