Solved

File upload, via my HTTP to my anon FTP site

Posted on 1997-06-17
3
218 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

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now