Saturday 15 June 2013

CGI perl read and print the content of a file -


I wanted to open a text file and use the CGI and Pearl I wrote a script but it does not work. Where is my problem

  #! C: /wamp/apps/Perl/bin/perl.exe-wt Usage CGI; My $ CGI = CGI- & gt; new (); Print $ cgi- & gt; Header ('text / html'), $ cgi- & gt; Start_html ('Remove Text'), $ cgi- & gt; H1 ({-style = & gt; 'color: red; background color: #eee;'}, 'extract CGI'), $ cgi- & gt; Start_Size (-Enctip = & gt; and CGI :: Multitart), 'Upload Your Text File:', $ cgi- & gt; Filefield (-name) = & gt; 'Filename',), $ cgi- & gt; Submit (-value = & gt; 'Read File'), my $ txtfile = $ cgi- & param; 'Ultimate' ('filename'), $ $ in my $ file name or die ("could not open"); While (my $ line = <$ in & gt;) {print $ line; Last if $ == 10; } Around $ IN; $ Cgi- & gt; End_form; $ Cgi- & gt; END_HTML;    

You can find this useful

By default, the uploaded file is not designated as a file passed from the browser

You need to do some checks about anything sent before.

No comments:

Post a Comment