Why not select the file on the html page ?
<!DOCTYPE html> <html> <head> <title>MAINTENANCE PAGE</title> </head> <body> <form action="Maintenance_Framework.cgi" method = "post" enctype="mult +ipart/form-data"> <p>MAINTENANCE PAGE<br/> Circle: <select name="Circle" > <option value="Gabon">Gabon</option> <option value="Tanzania">Tanzania</option> </select> Technology : <select name="Techno" > <option value="Core">Core</option> <option value="RAN">RAN</option> </select> </p> <br> File to Upload: <input type="file" name="filecsv"/> <input type="submit" value="Upload"/> </form> </body> </html>
poj#!/usr/lib/perl # Maintenance_Framework.cgi use strict; use warnings; use CGI; use CGI::Carp 'fatalsToBrowser'; # debug only $CGI::POST_MAX = 1024 * 5000; my $upload_dir = '/opt/IBM/Maintenance/tmp'; my $q = new CGI; my $Circle = $q->param('Circle'); my $Techno = $q->param('Techno'); my $newfilename = $Circle.'abc'.$Techno.'.csv'; my $upload_filehandle = $q->upload("filecsv"); open OUT, '>',"$upload_dir/$newfilename" or die "$!"; binmode OUT; while ( <$upload_filehandle> ) { print OUT; } close OUT; print $q->header; print << "HTM"; <html> <head><title>Maintenance Page</title></head> <body> <p>Thanks for uploading your file as $newfilename</p> </body></html> HTM
In reply to Re: Need to use data passed from FORM from HTML page to CGI upload script.
by poj
in thread Need to use data passed from FORM from HTML page to CGI upload script.
by coolsaurabh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |