// See if they have submitted or just need the form
if(request.method == "POST"){
// Create an instance of the File object and pass it the file
// the user specified they wanted to view.
var myLog = new File(request.file);
// Try to open the file.
if(!myLog.open("r")){
// If there was an error, tell the user.
write("There was an error opening the file: " + request.file);
}else{
// If there was not an error, then open the file and display it.
write('The contents of ' + request.file + ' are as follows:
);
while(!myLog.eof()){
write(myLog.readln());
}
}
}else{
// If this page was called then write the select box to the page for
// the user to use select which log they want to see.
write('');
}