Question
(7 pts.). Write an HTML document prob3.html ,which is placed below your document root, and whose initial rendering is shown in the screenshot at right.
(7 pts.). Write an HTML document prob3.html,which is placed below your document root, and whose initial rendering is shown in the screenshot at right. The button labeled Browse is the rendering of an input element with type="file" and name="datafile". The Blackboard page for this assignment provides a file data.txt, whose content is as follows.
30 10 28 a3 29 12 31 9
These numbers are supposed to be the enrollments by gender in repeated offerings of a given course. In each line, the first number is the number of males, and the second number is the number of females. Note that the second line has an error: a3 cannot be interpreted as a number. Place data.txt in the same folder as prob3.html. Click the Browse button and navigate to data.txt and select it, giving a rendering as in the screenshot at right. The button labeled Send File is the submit button. When clicked, a POST request with the uploaded file is sent to prob3.php, which is in the same folder as prob3.html. It is Script prob3.php moves the data file to folder uploads immediately below the document root (i.e., the server sees this folder as "/uploads/"). It then opens this file and reads it. It sums the number of males and the number of females and includes the totals in the HTML of its response. Any lines in the file that cannot be interpreted as two numbers are echoed back, identified as ill-formed; they do not contribute to the totals. The screenshot at right shows the rendering of the response. Use a regular expression to extract the two numbers from a line read from the file. Allow any amount of whitespace (including none) before the first number and any amount of white space (including none) after the second number. Be sure to use the ^ and $ anchors. There must be some whitespace (and nothing else) between the two numbers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started