Connecting Tech Pros Worldwide Forums | Help | Site Map

CGI upload files without using CGI.pm

Member
 
Join Date: May 2007
Posts: 113
#1: Jun 13 '07
Hi..

Does anyone know how to do file uploading with CGI using perl but not using the CGI.pm module?

Thanks!
miller's Avatar
Moderator
 
Join Date: Oct 2006
Location: San Francisco, CA
Posts: 830
#2: Jun 13 '07

re: CGI upload files without using CGI.pm


I've seen it done before a long time ago, but I always use CGI.

If you're really curious you could always inspect the source code to the CGI module.

- Miller

PS,
If this is anything more than a curiousity, then I would not suggest that your pursue it.
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#3: Jun 13 '07

re: CGI upload files without using CGI.pm


ignoring some security issues:

Expand|Select|Wrap|Line Numbers
  1. open (FILE,">path/to/upload/folder/$in{file}");
  2. binmode (FILE);
  3. print FILE $in{file};
  4. close (FILE);
where $in{file} is the name of the file field in your form.
Member
 
Join Date: May 2007
Posts: 113
#4: Jun 14 '07

re: CGI upload files without using CGI.pm


Quote:

Originally Posted by miller

I've seen it done before a long time ago, but I always use CGI.

If you're really curious you could always inspect the source code to the CGI module.

- Miller

PS,
If this is anything more than a curiousity, then I would not suggest that your pursue it.


Hi... its not out of curiousity.. but due to facing problem installing my cgi module so i am looking at another alternative.

Seems like its not going to be an easy way.

Is is possible for me to copy the CGI file and include it inside my source code?

eg: use /lib/perl5/5.8.8/CGI.pm
miller's Avatar
Moderator
 
Join Date: Oct 2006
Location: San Francisco, CA
Posts: 830
#5: Jun 14 '07

re: CGI upload files without using CGI.pm


Quote:

Originally Posted by skyy

Hi... its not out of curiousity.. but due to facing problem installing my cgi module so i am looking at another alternative.

What method are you using to install the CGI modules?

Please include the system that you are running under: OS, perl version, etc.

- Miller
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#6: Jun 14 '07

re: CGI upload files without using CGI.pm


are you using "wamp" or some bundled application? One of those bundled applications is serioulsy flawed when it comes to the perl distribution, and you can't add modules. I can't remember which one it is though.
Member
 
Join Date: May 2007
Posts: 113
#7: Jun 14 '07

re: CGI upload files without using CGI.pm


Quote:

Originally Posted by miller

What method are you using to install the CGI modules?

Please include the system that you are running under: OS, perl version, etc.

- Miller

Hi..

I posted on another forum regarding installing perl on arm-linux. Cant seems to find a solution. I can run very basic perl program. But when i try to install CGI module it gives me error in installing.

Perl v5.8.8
Arm-linux
kernel 2.4.20

I downloaded the CGI module and untar it. when i try to install using:

perl Makefile.PL

Error in installing perl module:
Attemp to free unreferenced scalar..

Hence i cant continue with the installation.
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#8: Jun 14 '07

re: CGI upload files without using CGI.pm


The CGI module comes with nearly all distributions of perl. I don't know why you would not already have it installed.
Reply