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 |
 |
 |
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
|
 |
 |
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 |
 |
 |
|