-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show uploading from stream and from a file
- Loading branch information
Showing
2 changed files
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,14 @@ use io\File; | |
|
||
$c= (new FtpConnection('ftp://user:[email protected]/'))->connect(); | ||
|
||
// Upload index.txt to the connection's root directory | ||
$c->rootDir()->file('index.txt')->uploadFrom(new File('index.txt'), FtpTransfer::ASCII); | ||
// Upload logo.png to the connection's root directory | ||
$c->rootDir()->file('logo.png')->uploadFrom(new File('logo.png')); | ||
|
||
// Upload from a stream using ASCII mode | ||
$c->rootDir()->file('README.md')->uploadFrom( | ||
new MemoryInputStream('Read me first!'), | ||
FtpTransfer::ASCII | ||
); | ||
|
||
$c->close(); | ||
``` | ||
|