Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 18-08-2010
Member
 
Join Date: Jan 2010
Posts: 311
Firefox problem with perl script

Hello,
I use a perl script to fetch the variables of a form to then execute the applications using the DBI module for perl. But I have a small problem with Firefox at this level:

Here is my code
Code:
###### Creating the html file back to the execution of perl script
print "Content-type: text / html \ n \ n";
print "<html> <head> <link rel='stylesheet' href='../public_html/test.css' type='text/css'> </ head> \ n";
print "<body> <h1> Verification inclusion </ h1> \ n";
print "<br> \ n";
print "<form method='post' action='pagename'> \ n";
print "<input type='submit' value='Retour'> </ form> \ n";
print "foo \ n";
print "</ body> </ html> \ n";

In Internet Explorer, my html page is displayed correctly, the browser Comprises the html code, while in firefox, it does not bind the code, it just displays. Is there a problem with firefox and this type of use? How to solve this problem?
Reply With Quote
  #2  
Old 18-08-2010
Member
 
Join Date: May 2008
Posts: 248
Re: Firefox problem with perl script

You must indicate the type of document you sent. The top of your scrip, the first print must be:
Code:
print "Content-Type: text / html \ n \ n";
Just add it to to your script or you can even modify your or replace your script by the following line of code.
Reply With Quote
  #3  
Old 18-08-2010
Member
 
Join Date: Mar 2010
Posts: 162
Re: Firefox problem with perl script

This is the code you are looking for

Code:
use testcgi (qw: standard);
use str;
my $ testcgi = new testcgi;
print $ testcgi-> header ();
print $ testcgi-> start_html (-title => 'page title'
                       -Style => '.. / public_html / leptostyle.css');
print $ testcgi-> h1 ('Verification of integration'), $ testcgi-> br ();
print $ testcgi-> START_FORM (-name => 'name of the form'
                        -Method => 'post'
                        -Action => '.. / public_html / index.php? Page = insert');
print $ testcgi-> submit (-name => 'button',-value => 'Back');
print "foo \ n";
print $ testcgi-> END_FORM (), $ testcgi-> end_html ();
Reply With Quote
  #4  
Old 18-08-2010
Member
 
Join Date: Nov 2009
Posts: 330
Re: Firefox problem with perl script

Your question is not a problem with HTML and PERL. Your HTML script is full of errors, such as unfinished form, no title page, no form name, and the header does not seem to me correct. In any HTML page, rather I see a header like:
Code:
<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN">
Change this in your code and run a test on it.
Reply With Quote
  #5  
Old 18-08-2010
Member
 
Join Date: Jan 2010
Posts: 311
Re: Firefox problem with perl script

Thanks for your replies, another question, can I use PHP instead of HTML? Because in fact, I have a html page consists of a form and a field to upload a file. When I validate my form, I run my perl script that retrieves the variables from my form. After treatment of my variables, my script needs then the file I uploaded. Before I use a php page to process the upload:
Here is my code
Code:
<Php
/ / In PHP 4.1.0, $ HTTP_POST_FILES should be used
/ / Instead of $ fls.
$ updri = 'C: \ Program Files \ EasyPHP1-8 \ www \ public_html \ upload \ \';
$ = $ upfl updri. basename ($ fls ['userfile'] ['name']);
echo '<pre>';
if (move_uploaded_file ($ fls ['userfile'] ['tmp_name'], $ upfl)) (
   echo "File is valid, and has been downloaded
           successfully. Here is more info: \ n ";
) else (
   echo "potential attack by downloading files.
         Here is more info: \ n ";
)
/ / Echo 'Here is some debug info:';
/ / Print_r ($ fls);
echo '</ pre>';
?>
Reply With Quote
  #6  
Old 18-08-2010
Member
 
Join Date: Dec 2009
Posts: 192
Re: Firefox problem with perl script

Why do you manage does not upload directly into your PERL script? To manage the upload, you must:

1. Declare the HTML form in "multipart", with the following line:

Code:
print $ testcgi-> start (-method => "POST",
                                      -Action => "test.pl"
                                      -Name => "ifroumla");
2. Declaring a field for the user to define the import file:
Code:
Code:
print $ testcgi-> FileField (-name => 'dumpdata',-size => 50);
(There are other properties available, I think In particular with a filter extensions it seems to me)

3. Recover the file if the user submitted the form with its roster set:
Code:
if ( defined \ $ testcgi-> param ('testing code'))
(
   my $ f_hd = $ testcgi-> param ('testing code');
   while (<$ f_hd>)
   (
      chomp;
      # Manage data read
   )
)
Reply With Quote
  #7  
Old 09-09-2010
Member
 
Join Date: Nov 2009
Posts: 347
Re: Firefox problem with perl script

You can use this

Code:
use CGI:: Upload;
     my $ upld = CGI:: Upload->new;
     my $ flnm = $ upld-> flnm ('field');
     my $ file_type = $ upld-> file_type ('field');
     $ Upload-> mime_magic ('/ path / to / mime.types');
     my $ mime_type = $ upld-> mime_type ('field');
     my $ upld = $ file_handle-> file_handle ('field');
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Firefox problem with perl script"
Thread Thread Starter Forum Replies Last Post
How to run Perl script on Mozilla Firefox? Grayson Software Development 5 02-11-2011 02:35 PM
How to call perl script from Python? Jhonwho Software Development 3 23-07-2009 09:59 PM
Is it possible to execute Perl script within another script? RasMus Software Development 2 21-07-2009 10:57 PM
Need Perl script to execute from another. beelow Software Development 2 20-06-2009 09:17 AM
Title of a Perl CGI script !const Software Development 2 26-03-2009 11:43 PM


All times are GMT +5.5. The time now is 05:32 PM.