Solved

File upload, via my HTTP to my anon FTP site

Posted on 1997-06-17
3
219 Views
Last Modified: 2013-12-25
Hi

I want setup a CGI that can upload a file via our web browser (Netscape) to my anon FTP site, not my HTTP. All the CGI I looked were done to upload to the same directorie of the CGI. I want upload in my ftp site (ftp://....) via my HTTP site (http://...). I try some, but they were like I see  before. My server is running the Unix and support perl 5 (perl 4 to). And, I only know the base of the perl. If someone know were I can find one like I want or could write it for me (I don't think someone will do this!), I'll appreciate. A last thing, I try all those in CGI-RESSOURCE and no one fit.


Thanks!
0
Comment
Question by:internouille
3 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1828289
Usually these are unrelated tasks, so you should look for resources on doing ftp, stole routines from them, and put them in your program with routines for file upload.

Rgds, julio
0
 

Accepted Solution

by:
jdd2 earned 150 total points
ID: 1828290
Well,

I would open a connection to the ftp site, whereas it is on
your site or not.
Let's take the README file. Call is something like:

http://your.http.site/cgi-bin/yourcgi?file_to_ftp=README

I would do:

#!/usr/local/bin/perl -Tw
#
# yourcgi
#
use strict ;
use CGI ;
use LWP ;
$ENV{'PATH'} = '/your/bin' ;       # -T option...
my $input = new CGI ;              # Get the parameter
my $URL = "ftp::/your.ftp.site" . $input->param('file_to_ftp') ;
my $ua = LWP::UserAgent->new ;
my $res = $ua->request(HTTP::Request->new('GET',$URL)) ;
unless ($res->is_success) {
  &Your_Error_Subroutine ;
  exit ;
}
my $file = $res-content ;
print $file ;
exit ;

Hope this fit your request,          Jean-Damien.

0
 

Author Comment

by:internouille
ID: 1828291
Thank you, for this help!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question