Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Html upload file to bash script Post 303031509 by Neo on Friday 1st of March 2019 12:12:25 PM
Old 03-01-2019
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
POE::Filter::HTTPD(3pm) 				User Contributed Perl Documentation				   POE::Filter::HTTPD(3pm)

NAME
POE::Filter::HTTPD - parse simple HTTP requests, and serialize HTTP::Response SYNOPSIS
#!perl use warnings; use strict; use POE qw(Component::Server::TCP Filter::HTTPD); use HTTP::Response; POE::Component::Server::TCP->new( Port => 8088, ClientFilter => 'POE::Filter::HTTPD', ### <-- HERE WE ARE! ClientInput => sub { my $request = $_[ARG0]; # It's a response for the client if there was a problem. if ($request->isa("HTTP::Response")) { my $response = $request; $request = $response->request; warn "ERROR: ", $request->message if $request; $_[HEAP]{client}->put($response); $_[KERNEL]->yield("shutdown"); return; } my $request_fields = ''; $request->headers()->scan( sub { my ($header, $value) = @_; $request_fields .= ( "<tr><td>$header</td><td>$value</td></tr>" ); } ); my $response = HTTP::Response->new(200); $response->push_header( 'Content-type', 'text/html' ); $response->content( "<html><head><title>Your Request</title></head>" . "<body>Details about your request:" . "<table border='1'>$request_fields</table>" . "</body></html>" ); $_[HEAP]{client}->put($response); $_[KERNEL]->yield("shutdown"); } ); print "Aim your browser at port 8088 of this host. "; POE::Kernel->run(); exit; DESCRIPTION
POE::Filter::HTTPD interprets input streams as HTTP 0.9, 1.0 or 1.1 requests. It returns a HTTP::Request objects upon successfully parsing a request. On failure, it returns an HTTP::Response object describing the failure. The intention is that application code will notice the HTTP::Response and send it back without further processing. The erroneous request object is sometimes available via the "$r->request" in HTTP::Response method. This is illustrated in the "SYNOPSIS". For output, POE::Filter::HTTPD accepts HTTP::Response objects and returns their corresponding streams. Please see HTTP::Request and HTTP::Response for details about how to use these objects. PUBLIC FILTER METHODS
POE::Filter::HTTPD implements the basic POE::Filter interface. CAVEATS
Some versions of libwww are known to generate invalid HTTP. For example, this code (adapted from the HTTP::Request::Common documentation) will cause an error in a POE::Filter::HTTPD daemon: NOTE: Using this test with libwww-perl/5.834 showed that it added the proper HTTP/1.1 data! We're not sure which version of LWP fixed this. This example is valid for older LWP installations, beware! use HTTP::Request::Common; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); $ua->request(POST 'http://example.com', [ foo => 'bar' ]); By default, HTTP::Request is HTTP version agnostic. It makes no attempt to add an HTTP version header unless you specifically declare a protocol using "$request->protocol('HTTP/1.0')". According to the HTTP 1.0 RFC(1945), when faced with no HTTP version header, the parser is to default to HTTP/0.9. POE::Filter::HTTPD follows this convention. In the transaction detailed above, the Filter::HTTPD based daemon will return a 400 error since POST is not a valid HTTP/0.9 request type. Upon handling a request error, it is most expedient and reliable to respond with the error and shut down the connection. Invalid HTTP requests may corrupt the request stream. For example, the absence of a Content-Length header signals that a request has no content. Requests with content but not that header will be broken into a content-less request and invalid data. The invalid data may also appear to be a request! Hilarity will ensue, possibly repeatedly, until the filter can find the next valid request. By shutting down the connection on the first sign of error, the client can retry its request with a clean connection and filter. Streaming Media It is possible to use POE::Filter::HTTPD for streaming content, but an application can use it to send headers and then switch to POE::Filter::Stream. From the input handler (the InputEvent handler if you're using wheels, or the ClientInput handler for POE::Component::Server::TCP): my $response = HTTP::Response->new(200); $response->push_header('Content-type', 'audio/x-mpeg'); $_[HEAP]{client}->put($response); $_[HEAP]{client}->set_output_filter(POE::Filter::Stream->new()); Then the output-flushed handler (FlushEvent for POE::Wheel::ReadWrite, or ClientFlushed for POE::Component::Server::TCP) can put() chunks of the stream as needed. my $bytes_read = sysread( $_[HEAP]{file_to_stream}, my $buffer = '', 4096 ); if ($bytes_read) { $_[HEAP]{client}->put($buffer); } else { delete $_[HEAP]{file_to_stream}; $_[KERNEL]->yield("shutdown"); } SEE ALSO
Please see POE::Filter for documentation regarding the base interface. The SEE ALSO section in POE contains a table of contents covering the entire POE distribution. HTTP::Request and HTTP::Response explain all the wonderful things you can do with these classes. BUGS
Many aspects of HTTP 1.0 and higher are not supported, such as keep-alive. A simple I/O filter can't support keep-alive, for example. A number of more feature-rich POE HTTP servers are on the CPAN. See <http://search.cpan.org/search?query=POE+http+server&mode=dist> AUTHORS &; COPYRIGHTS POE::Filter::HTTPD was contributed by Artur Bergman. Documentation is provided by Rocco Caputo. Please see POE for more information about authors and contributors. perl v5.14.2 2012-05-15 POE::Filter::HTTPD(3pm)
All times are GMT -4. The time now is 10:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy