CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Save File To Different Server?

Print topic Send  topic

Author Message
maxhugen

Posts: 272
Posted: 12/15/2008, 3:47 AM

I've created a csv file AOK, but I actually need to save it to a different server. Anyone have an idea on how to do that?

I have the server IP address and required folder, plus username and password, but I don't know where to start. Any tips or links would be really welcome!

Cheers
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message
Zye

Posts: 56
Posted: 12/15/2008, 10:25 AM

I have this code (PHP - Curl) that I use to FTP a file to a remote server. I actually have a form on the page. Maybe you can adapt it.

// Page_AfterInitialize

if (isset($_POST['Submit'])) {
if (!empty($_FILES['upload']['name'])) {
$ch = curl_init();
$localfile = $_FILES['upload']['tmp_name'];
$fp = fopen($localfile, 'r');
curl_setopt($ch, CURLOPT_URL, 'ftp://username:password@ftpaddress/'.$_FILES['upload']['name']);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
curl_exec ($ch);
$error_no = curl_errno($ch);
curl_close ($ch);
if ($error_no == 0) {
$error = 'File uploaded succesfully.';
} else {
$error = 'File upload error.';
}
} else {
$error = 'Please select a file.';
}
}

For more info maybe search Curl FTP upload.
Cheers!

Zye
View profile  Send private message
maxhugen

Posts: 272
Posted: 12/15/2008, 4:03 PM

Thanks Zye, I'll check this out!
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.