cURL / Mailing Lists / curl-library / Single Mail


How to encode names for FTP ?

From: Silex <>
Date: Fri, 31 Mar 2006 18:31:24 +0200


I have a small question reguarding how I am supposed to encode names with
libcurl when doing FTP.

Basically, I'm uploading a file and its name may contains spaces or weird
characters like %.

As far as I understood, whenever I set CURLOPT_URL, I must replace the %
contained in it with %25, is that right ?
I must not try to add quotes or whatever if there's a space in the file
name, and I must only treat the % char.
It seems that I should *not* use curl_escape for that because otherwise
things like / etc get encoded as well.

Now, after uploading the file, I use a curl_slist along with
CURLOPT_POSTQUOTE to do a chmod on the file. Here too, should I replace the
% the same way for the filename ?

Thank you in advance
Received on 2006-03-31