cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Possible Issue with libCURL File Download

From: Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch>
Date: Mon, 8 Jul 2013 13:37:23 +0200

 
Ryan wrote:

> I'm trying to write a program that downloads a file from a remote FTP
server, appends one line to the end of it, and then re-uploads it...

You probably would have a much lighter solution using option
CURLOPT_APPEND.

> ... which is the size of the remote directory listing mysteriously
getting tagged onto the front of the file).

I did not run your program, but from reading the code, it seems you
effectively download the root directory. I mean you call
download(...REMOTE_URL...) which is the server name only
(ftp://orangesquirrels.com) while you probably intended to download
ftp://orangesquirrels.com/musiclist.txt.

Try using

download(DATABASE_FILE, "musiclist.txt", REMOTE_URL "/"
REMOTE_DATABASE_FILE, "Testing 123");

And in any case, check the content of the local file before uploading...

Although this is not the cause of your problem, please also note that
curl_global_init()/curl_global_cleanup() should normally be called once:
I suggest you do this in the main program.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-08