-
-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFTP put operation fails if used with remote file stream as resource #1177
Comments
Crux of the problem seems to be a failure of reading http stream stats with fstat. It returns There is a disclaimer on docs page:
A simple snippet to reproduce:
Of course, handling remote streams bears more questions like resumes via range header, efficiently copying it chunk by chunk, as it's not viable to just copy the remote stream to memory stream. As this library can create and register a wrapper, I think it'd be possible to open a remote handle for sftp and do: |
There is a stream wrapper for phpseclib's SFTP implementation which you
might want to use as a workaround.
https://github.com/phpseclib/phpseclib/blob/2.0.6/
phpseclib/Net/SFTP/Stream.php
|
Here is my usage example of stream wrapper:
It indeed works, but file gets uploaded to root directory instead. I'm fiddling with that nuisance now. |
Guessing: sftp://host/./path to upload to home/pwd.
|
@bantu 👏 I just wish interaction via Also, how about disallowing using remote streams with |
deb485c seemed to fix the issue for me. |
@terrafrost Thank you. I confirm deb485c fixes the issue. Now using a stream wrapper and |
Hi,
I'm using version
2.0.6
ofphpseclib
viaflysystem-sftp
(bridge/adapter for flysystem).I want to "stream" a remote file directly to sftp server, avoiding disk usage on a machine I run the script on. For that, I:
fopen
a remote file usinghttp
stream wrapperSFTP::put
with opened remote file handle as$data
The result is an empty file created on sftp server.
Reading documentation, I have noticed a
SOURCE_LOCAL_FILE
mode. I have already seen #1119 which treats about somewhat similar case, but for local files.Conceptually, I'd expect this case to handle that.
Is that the case that
put
with remote file as a stream is not supported?The text was updated successfully, but these errors were encountered: