Edit report at https://bugs.php.net/bug.php?id=63766&edit=1
ID: 63766
User updated by: mattsch at gmail dot com
Reported by: mattsch at gmail dot com
Summary: sftp upload CURLOPT_URL errors with code 79 with
directory path
Status: Not a bug
Type: Bug
Package: cURL related
Operating System: Gentoo
PHP Version: 5.4.9
Block user comment: N
Private report: N
New Comment:
That does not explain why it fails when you try to upload to a directory. So
what you're saying is this is not a bug because it's not possible to do this
with curl and you must always specify a url with a filename to upload a file?
And if that's the case, why is it not possible to upload a file to a directory?
Previous Comments:
------------------------------------------------------------------------
[2012-12-18 07:20:48] [email protected]
See previous comments
------------------------------------------------------------------------
[2012-12-18 07:11:27] [email protected]
The CURLOPT_URL option is of course to generically set a URL to work with.
libcurl accepts whatever URL you set and will try to work on it once you ask
curl to perform on it.
A URL that ends with a slash is treated as a directory by libcurl when you're
downloading something from it. It will then (depending on protocol) ask for a
directory listing instead of trying to fetch a file with that name.
libcurl assumes the users knows what (s)he is doing and will try to perform the
requested operation on the given URL. Uploading to a directory name is probably
going to fail on most systems.
------------------------------------------------------------------------
[2012-12-17 14:48:16] mattsch at gmail dot com
Could you elaborate as to why this would be a bad url? The documentation on
the curl website seems to indicate that you can specify a url without a
filename at the end but then the examples are not specific to upload:
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTURL
------------------------------------------------------------------------
[2012-12-17 12:17:00] [email protected]
This is not a libcurl bug. If you think about it for a while, libcurl doesn't
know the 'foo' name, it is only given the (bad) URL and it cannot but to fail
in
this case.
I'm also convinced you can see the same problem with other protocols than SFTP
for the same reason.
------------------------------------------------------------------------
[2012-12-17 01:23:46] [email protected]
Reopened per previous comments, although I wonder if this might be a libcurl
issue rather than a PHP one.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=63766
--
Edit this bug report at https://bugs.php.net/bug.php?id=63766&edit=1