For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > November 2004 > Re: One line file as an array (Form included)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: One line file as an array (Form included)
J. Alejandro Ceballos Z.

2004-11-26, 3:55 pm


[color=darkred]
> 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



[color=darkred]
[color=darkred]

[color=darkred]
> 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="center"><tbody><tr>
<td align="right">Create services SQL file: </td>
<td valign="top"><input type="file" name="file"></td>
</tr><tr>
<td valign="top" align="right">Licence: </td>
<td valign="top"><input type="text" name="licence"
value="demo"></td>
</tr><tr>
<td valign="top" align="right">Login: </td>
<td valign="top"><input type="text" name="login"
value="webmaster"></td>
</tr><tr>
<td valign="top" align="right">Password: </td>
<td valign="top"><input type="text" name="password" value="*"> </td>
</tr><tr>
<td valign="top" align="right"><br></td>
<td valign="top"><input type="submit" name="init"
value=" INIT "></td>
</tr></tbody>
</table>
</form>



--



Saludos,


J. Alejandro Ceballos Z. |
-------------------------------+------------------------------
http://alejandro.ceballos.info |
buzon@alejandro.ceballos.info |
-------------------------------+
|

Gunnar Hjalmarsson

2004-11-26, 3:55 pm

J. Alejandro Ceballos Z. wrote:
>
> 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.

>
> <form action="/cgi-bin/i-nstaller.cgi" method="POST" target="_blank">
> <table cellpadding="2" cellspacing="2" border="0" width="400"
> align="center"><tbody><tr>
> <td align="right">Create services SQL file: </td>
> <td valign="top"><input 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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com