Html upload file to bash script


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Html upload file to bash script
# 8  
Old 03-01-2019
To repeat:

Quote:
BASH has no helpful features for interpreting CGI data. CGI gives you a few predfined variables, a raw data stream, and that's it.
That means it doesn't create the file for you, or do anything else for you.

To repeat:

Quote:

Use this script and see what appears when you throw a file into it:

Code:

Code:
#!/bin/sh

# disable filename globbing
set -f

echo "Content-type: text/plain; charset=iso-8859-1"
echo

echo CGI/1.0 test script report:
echo

echo argc is $#. argv is "$*".
echo

echo SERVER_SOFTWARE = $SERVER_SOFTWARE
echo SERVER_NAME = $SERVER_NAME
echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE
echo SERVER_PROTOCOL = $SERVER_PROTOCOL
echo SERVER_PORT = $SERVER_PORT
echo SERVER_PROTOCOL = $SERVER_PROTOCOL
echo SERVER_PORT = $SERVER_PORT
echo REQUEST_METHOD = $REQUEST_METHOD
echo HTTP_ACCEPT = "$HTTP_ACCEPT"
echo PATH_INFO = "$PATH_INFO"
echo PATH_TRANSLATED = "$PATH_TRANSLATED"
echo SCRIPT_NAME = "$SCRIPT_NAME"
echo QUERY_STRING = "$QUERY_STRING"
echo REMOTE_HOST = $REMOTE_HOST
echo REMOTE_ADDR = $REMOTE_ADDR
echo REMOTE_USER = $REMOTE_USER
echo AUTH_TYPE = $AUTH_TYPE
echo CONTENT_TYPE = $CONTENT_TYPE
echo CONTENT_LENGTH = $CONTENT_LENGTH
echo "Content begins:"
echo =====
dd count=1 bs=$CONTENT_LENGTH
echo
echo =====
echo "Content ends"

You have to create the file yourself. CGI feeds data into standard input and variables. Run the script to see what data you're given.
# 9  
Old 03-01-2019
Quote:
Originally Posted by Naz
Thanks for the reply.

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.
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Html form to submit data to bash script

hi all, im going to design a web html form so users can input what username and password they want to make the ftp account, once they enter in a username and password they click on the submit button and it submits it to a bash script and then the bash script will run and finish of making the... (3 Replies)
Discussion started by: robertkwild
3 Replies

2. UNIX for Dummies Questions & Answers

Read data from excel and upload into html page

Hi, I have requirement for automation, wanna confirm whether is it possible in shell scripting. 1) Need to read data from excel sheet 2) And upload the details in html page I know first requirement is possible by converting excel into csv form, but not sure about the second one. If... (6 Replies)
Discussion started by: stew
6 Replies

3. Shell Programming and Scripting

SSH Script For Automatic File Upload HELP

Hi guys! I hope this hasn't been asked too many times but, Would someone be able to help me write or point me in the direction to some helpful tutorials in order to write a script to transfer a file directly to a server via SSH from a linux based computer. The script should do as following:... (2 Replies)
Discussion started by: craigwilkinson
2 Replies

4. Shell Programming and Scripting

HTML code upload text file grep through shell script

I am looking for HTML code that browse text file and grep with database file then retrieve result txtfileuploaded contain 112233 115599 113366 shell code grep -F -f txtfileuploaded /data/database.txt result 112233 Mar 41$ 115599 Nov 44$ 113366 Oct 33$ attached... (2 Replies)
Discussion started by: phpshell
2 Replies

5. Shell Programming and Scripting

pass argument to html upload form

I am using an html form and a php upload script to upload files. HTML form <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form action="upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <td> <table... (1 Reply)
Discussion started by: anil510
1 Replies

6. Shell Programming and Scripting

Get checkbox checked value from html page to the bash script

hi i m printing all current running processes into an html page with checkbox for each process , using bash script i want to get(retrive) the value of that checked checkbox to kill the process ,can anybody please helpme out thanks in advance (1 Reply)
Discussion started by: vagga06
1 Replies

7. Shell Programming and Scripting

Bash shell script that inserts a text data file into an HTML table

hi , i need to create a bash shell script that insert a text data file into an html made table, this table output has to mailed.I am new to shell scripting and have a very minimum idea of shell scripting. please help. (9 Replies)
Discussion started by: intern123
9 Replies

8. UNIX for Dummies Questions & Answers

Bash script to insert data into an html table

hi, I need to create a bash shell script which picks up data from a text file and in the output file puts it into an html made table. I have to use sed and awk utilties to do this the input text file will contain data in the format: job name para1 para2 para3 para4 para4 1 ... (1 Reply)
Discussion started by: intern123
1 Replies

9. Shell Programming and Scripting

bash script for ftp-upload is not working

Hello everyone, sorry for the title, most of you must getting sick of reading something like this, but I haven't found a solution, although I found many threads according to it. I'm working on a bash script that connects to a network printer with ftp where I want to upload a pdf created... (3 Replies)
Discussion started by: le_mae
3 Replies

10. Shell Programming and Scripting

help with a bash script to create a html table

Hi guys as the title says i need a little help i have partisally written a bash script to create a table in html so if i use ./test 3,3 i get the following output for the third arguement in the script i wish to include content that will be replace the A characters in the... (2 Replies)
Discussion started by: dunryc
2 Replies
Login or Register to Ask a Question