This is a simple beginner's explanation of using wget in bash. Please read the WHOLE page. wget is meant to get files from the internet to your computer. IF you are at work and behind security (Example: a proxy or a nat server) things may get more complicated. See if this meets your needs.
You access the file in your form using a web server set up handle scripts with file extension .sh .
But frankly, no experienced web developer uses bash for processing HTTPD $_GET and $_POST requests (unless they have some tiny web site and are just playing around) because bash is not designed to handle HTTPD requests (like HTTP headers, cookies, and more) like other programming languages are.
If you are serious about learning web development, you should use a language build for processing HTTPD requests, like server-side Javascript, PHP, etc.
FWIW, I disagree with the statement in the quote above " it still can find its place in Linux system administrator's hands as a quick tool for system monitoring and administration via web browser", because there is no place for using obsolete languages not designed for the web as a CGI when you have so many better choices (PHP, node.js, Python, etc).
I have been administering web servers "forever", and never once have I ever written or used a bash CGI like described in the link above. It's simply the wrong tool for the job.
I will add little more information. I can read the web input from the bash script and I have no problem with form data like Name, Address, emal,...etc. When it comes to the file it seems I am only getting just the name.
DOCFILE="test.pdf"
Both these commands returned not true.
if [ -r "$DOCFILE" ] then ... fi
if [ -f "$DOCFILE" ] then ... fi
Why are you doing this? It this a homework problem?
The reason I ask, which we have pointed out to you before, is that bash is not designed to fully support HTTPD requests , natively; and so no serious web developer would be using bash as CGI. Even minor web-based tasks are better left to PHP, Python, node.js (server side javascript) etc.
So, if you are not doing homework, designed to teach you to do something using suboptimal tools and methods, why are you insisting to use the wrong tool for the job?