473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HTTP File Posting

I am hoping to find a way to post a file to a remote web page in an
automatic way using a perl script on a Windows machine. I prefer not to
use FTP as I have to put passwords in the script. I'd also like to avoid
SMTP.

Is there a way to have a perl program send a local file to a remote
computer using http?
Thanks
Mark
Jul 19 '05 #1
2 3825
mlm45 wrote:
Is there a way to have a perl program send a local file to a remote
computer using http?


Yes, provided that the remote computer is set up for file uploads.

There has to be a CGI on the remote web server explictly designed
to accept HTTP POST of file data. Check out LWP, lwp-cookbook, and
HTTP::Request::Common. Docs for the latter mention Form-Based File Upload.
-Joe
Jul 19 '05 #2
On Wed, 07 Apr 2004 12:01:26 -0500, mlm45 wrote:
I am hoping to find a way to post a file to a remote web page in an
automatic way using a perl script on a Windows machine. I prefer not to
use FTP as I have to put passwords in the script. I'd also like to avoid
SMTP.

Is there a way to have a perl program send a local file to a remote
computer using http?
Thanks
Mark


I recently wrote something like that. Unfotunately, I use FTP.
Try something like this:
#!/usr/bin/perl -w

use Net::FTP;
use Cwd;

$Host = "ftp.whatever.com" ;
$User = "loginname" ;
$Pwrd = "password" ;
$Dir = "/www" ; # i.e. the target dir on the remote server

print "<p>\n\nConnecting to $Host " ;
$ftp = Net::FTP->new($Host, Debug => 0)
|| die "Cannot connect to '$Host' : '$@' " ;

print "<br>Logging in user '$User', and password ... " ;
$ftp -> login ($User, $Pwrd)
|| die "Cannot login ", $ftp->message ;

print " cwd to '$Dir', " ;
$ftp -> cwd ($Dir)
|| die "Cannot change dir to '$Dir'" ;

print "<br>Writing files : " ;
foreach $File (@FileList) {
$ftp -> put ($File)
|| die "Cannot put file ", $ftp->message ;
}

print "<br>Done. Logging out. " ;
$ftp -> quit ;

hth,

Arno Reuser

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType =...
1
by: Juan Dent | last post by:
Hi, The Request.SaveAs method stores in a file the complete HTTP request including the HttpVersion. However when I try to reproduce in memory the same thing, I cannot find the "HTTP/1.1"...
11
by: Dorsa | last post by:
HI, Could you please tell me the error in here. I am trying to open an XML file from a link. Response.Clear() Response.Expires = 0 Response.BufferOutput = False Response.ContentType =...
2
by: Praveen | last post by:
Hi All, I have made a webservice in C# and it works fine in my machine. I ran into a crazy problem when I wanted to deploy it in windows 2003 server. I have run "aspnet_regiis.exe -i" to make...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
5
by: David Thielen | last post by:
Hi; I am creating png files in my ASP .NET app. When I am running under Windows 2003/IIS 6, the file is not given the security permissions it should have. It does not have any permission for...
8
by: Tim Reynolds | last post by:
Our .Net application calls a web method of aplpication 2 that resides on their Apache server. When I as a developer C#, Studios 2003, make the call to their web method from my desktop, I receive no...
5
by: David Lozzi | last post by:
Howdy, I wrote a web service in .Net for my customer. My customer has another vendor who now has to consume it but they are not using Visual Studio. Most of their pages are jsp, and they said...
11
by: Pete | last post by:
I was running the HTTP GET example at http://www.python.org/doc/current/lib/httplib-examples.html and ran into a bit of trouble... The errors I get are below. Any suggestions on how to get rid...
10
by: deciacco | last post by:
I'm writing a command line utility to move some files. I'm dealing with thousands of files and I was wondering if anyone had any suggestions. This is what I have currently: $arrayVirtualFile =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.