cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: The client FTP fails to change to the lowest subdirectory when uploading file.

From: Nageeb Khoury <nageeb.khoury_at_gmail.com>
Date: Mon, 30 Oct 2006 12:18:44 +0200

Thanks,

I think i found after hours of trials a way or workaround to switch to the
lowest directory bypassing the security permissions of the upper directories
in between by doing the following

I entered for CURLoption.CURLOPT_URL
ftp://<server>:<port>/<filename>
 and not
ftp://<server>:<port>/<defaultDir>/<filename>
and then did a directory switch to the <defaultDir>

Here is a part of the code the solves the problem
(Any other option failed for me)

Slist slist = new Slist();
easy.SetOpt(CURLoption.CURLOPT_URL, ftpURL + fileName);
slist.Append("CWD /" + defaultDir);
easy.SetOpt(CURLoption.CURLOPT_NOBODY,false);
easy.SetOpt(CURLoption.CURLOPT_QUOTE, slist);
Easy.ReadFunction rf = new Easy.ReadFunction(OnReadData);
easy.SetOpt(CURLoption.CURLOPT_UPLOAD,true);
easy.SetOpt(CURLoption.CURLOPT_READFUNCTION,rf);
easy.SetOpt(CURLoption.CURLOPT_READDATA,str);
easy.SetOpt(CURLoption.CURLOPT_ERRORBUFFER,true);
retVal = ftpConn.Perform();
slist.FreeAll();

On 10/28/06, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Sat, 28 Oct 2006, Nageeb Khoury wrote:
>
> (no need to cross-post, you speak of libcurl issues so let's keep it on
> the
> curl-library list)
>
> > Traces show that the CURL switches to the lowest directory by doing a
> > mulitple change directory (CDW ) for each part in the path (directories
> in
> > between) and not in one step to entire path. Filezilla client succeeds
> to
> > switch without problem.
>
> (nitpick) libcurl is called libcurl, we don't do anything named "CURL".
>
> libcurl actually tries to follow the RFC on how to walk down paths, and
> obviously Filezilla does not. Both ways have their ups and downs. But ...
>
> > My .NET client references the LibCurlNet.dll 1.3 with binding 7.13 (
> > libcurl.dll).
>
> ... libcurl 7.13 doesn't offer any other ways than that.
>
> > 3) I have tried to do the test 1 by changing the LibCurlNet.dll code by
> > adding CURLoption.CURLOPT_FTP_FILEMETHOD to the Enums.cs and using curl
> lib
> > v7.15 but without success.
>
> That's actually how it should be done and that should work and have in
> fact
> been verified to work for others in the past.
>
> Did you really get the LibCurlNet.dll built properly to support this new
> option? If so, can you show us details on what it does and why it doesn't
> work
> for you? Can you use the curl command line to repeat the problems or does
> that
> make it right?
>
> 7.15 you say. I've never released any version called 7.15, which exact one
> did
> you really use? That option didn't exist until 7.15.1... And the enums
> were
> added in 7.15.3.
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
>
Received on 2006-10-30