Re: One line file as an array (Form included)
I am sending a text file with SQL statements via Form to a CGI. Are you trying to upload a file, or are you just sending the file contents as an ordinary parameter? Just the file contents as a parameter I am trying to make the file as a one line (and deleting extra spaces too), to later split them using the ; as delimiters. The problem is that after the operation, no lines are stored in the array. Any idea about what is happening? use CGI; my $cgi_this = new CGI; my $str_file = $cgi_this-param('file'); $str_file =~ s/\s+/ /gs; my @arr_sqlqueries = split (/;/, $str_file); Please show us the form. form action=/cgi-bin/i-nstaller.cgi method=POST target=_blank table cellpadding=2 cellspacing=2 border=0 width=400 align=centertbodytr td align=rightCreate services SQL file: /td td valign=topinput type=file name=file/td /trtr td valign=top align=rightLicence: /td td valign=topinput type=text name=licence value=demo/td /trtr td valign=top align=rightLogin: /td td valign=topinput type=text name=login value=webmaster/td /trtr td valign=top align=rightPassword: /td td valign=topinput type=text name=password value=* /td /trtr td valign=top align=rightbr/td td valign=topinput type=submit name=init value= INIT /td /tr/tbody /table /form -- Saludos, J. Alejandro Ceballos Z. | ---+-- http://alejandro.ceballos.info | [EMAIL PROTECTED] | ---+ | -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: One line file as an array (Form included)
J. Alejandro Ceballos Z. wrote: I am sending a text file with SQL statements via Form to a CGI. Are you trying to upload a file, or are you just sending the file contents as an ordinary parameter? Just the file contents as a parameter Well, the form you just posted includes a file select control, which tells me that it's actually a file upload you are trying to accomplish. Please see in the CGI docs how you can grab the contents of an uploaded file. I recommend that you make use of the upload method. Please show us the form. form action=/cgi-bin/i-nstaller.cgi method=POST target=_blank table cellpadding=2 cellspacing=2 border=0 width=400 align=centertbodytr td align=rightCreate services SQL file: /td td valign=topinput type=file name=file/td You should add enctype=multipart/form-data to the form tag. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
One line file as an array
I am sending a text file with SQL statements via Form to a CGI. I am trying to make the file as a one line (and deleting extra spaces too), to later split them using the ; as delimiters. The problem is that after the operation, no lines are stored in the array. Any idea about what is happening? use CGI; my $cgi_this = new CGI; my $str_file = $cgi_this-param('file'); $str_file =~ s/\s+/ /gs; my @arr_sqlqueries = split (/;/, $str_file); - I hope is not an other BB (basic and blind) error - Saludos, J. Alejandro Ceballos Z. | ---+-- http://alejandro.ceballos.info | [EMAIL PROTECTED] | | -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: One line file as an array
J. Alejandro Ceballos Z. wrote: I am sending a text file with SQL statements via Form to a CGI. Are you trying to upload a file, or are you just sending the file contents as an ordinary parameter? I am trying to make the file as a one line (and deleting extra spaces too), to later split them using the ; as delimiters. The problem is that after the operation, no lines are stored in the array. Any idea about what is happening? use CGI; my $cgi_this = new CGI; my $str_file = $cgi_this-param('file'); $str_file =~ s/\s+/ /gs; my @arr_sqlqueries = split (/;/, $str_file); Please show us the form. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response