curl-library
Re: Possible Issue with libCURL File Download
Date: Tue, 9 Jul 2013 10:12:14 +0800
Ah, yes, thank you! Your CURLOPT_APPEND did the trick. I also implemented your advice on the curl global functions...
On Jul 8, 2013, at 7:37 PM, "Patrick Monnerat" <Patrick.Monnerat_at_datasphere.ch> wrote:
>
> 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
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-09