473,382 Members | 1,373 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,382 software developers and data experts.

how to copy files from ftp directory to web-accessible directory?

I need to copy files from an ftp directory to a web-accessible directory and
then delete the files in the ftp directory. (I am doing it this way because
web-based form upload can not exceed 2MB and I can't change that)

Any ideas are much appreicated!
Nov 21 '06 #1
2 2836
Paul wrote:
I need to copy files from an ftp directory to a web-accessible directory and
then delete the files in the ftp directory. (I am doing it this way because
web-based form upload can not exceed 2MB and I can't change that)

Any ideas are much appreicated!
You can put a script like this on your webserver with the correct info,
then just run it in your browser. It will move the file.

<?php

$ftp_server = 'ftp.domain.com';
$ftp_user_name = 'ftpuser';
$ftp_user_pass = 'ftppass';
$server_file = '/ftppathtofile.ext';
$local_file = '/dirpathtofile.ext';

$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed.\n";
echo "Attempted to connect to $ftp_server for user $ftp_user_name.\n";
exit;
} else {
echo "Connected to $ftp_server.\n";
}

//DOWNLOAD
$download = ftp_get($conn_id, $local_file, $server_file, FTP_BINARY);
if ($download) {
echo "Successfully written to $local_file\n";
} else {
echo "There was a problem\n";
}

ftp_close($conn_id);

?>

Nov 22 '06 #2
thanks "pangea33" , I'll give it a try.
Nov 22 '06 #3

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

Similar topics

0
by: Casey | last post by:
Is there a way to copy only the changed files of a web application when doing an "Only files needed to run this application" copy, using VS.NET 2003. Visual Interdev 6.0 had the option to "Copy...
8
by: Chris Strobel | last post by:
I have 2 web servers where I need to write a PDF file and need to keep them in sync. In others words, If the Server1 is getting called to create the PDF, then it needs to copy the PDF to the other...
3
by: Steve Franks | last post by:
I think the Copy Web tool is a great idea but its implementation could use improvement. Either that or I am using it incorrectly. Basically I do not see any option to copy an entire site in one...
2
by: Steve Franks | last post by:
The Copy Web tool provided with VS.NET 2005 is very convenient. However every once in a while it seems to think the files on the remote server have changed, which they have not. Then when I use...
3
by: Jim McGivney | last post by:
I am a ASP.net 2.0 NewBee I have a simple website I developed in Web Developer Express. I test it with CTRL-F5 and it works. I have found out that I can not Web Copy it to my hosted web site. I...
1
by: JohnSouth | last post by:
Hi I've a C# application that needs to copy files between remote web locations (http:// or https://) I can copy XML files using WebRequest/WebResponse OK, but Word documents do not arrive as...
2
by: Matthew Moran | last post by:
I posted this on the .asp group but believe this may be a more appropriate forum. I have a need to have a web server (windows based) grab files each week from a linux based server - hosted...
1
by: Matthew Moran | last post by:
I have a need to have a web server (windows based) grab files each week from a linux based server - hosted elsewhere. I cannot use UNC paths. I want to have a script (.asp/asp.net) on the...
4
by: Tom | last post by:
Every week our web guys publish the web site to all of our servers by logging into the server and doing a copy - paiste. We want to elminate the developers from logging into each server and doing...
5
by: Cirene | last post by:
When would I use "Copy Web site" over "Publish Website" or visa versa? Why would I use the Web Deployment Project vs these options? I want to make sure no one can pull up/read/download my vb...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.