We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 949b200 commit 0be5126Copy full SHA for 0be5126
src/Remote/FtpFile.php
@@ -59,4 +59,27 @@ public function rename(string $newPath): bool
59
60
return $success;
61
}
62
+
63
+ /**
64
+ * @return false|string
65
+ */
66
+ public function getContent(): bool|string
67
+ {
68
+ $pointerLocation = ftell($this->fileHandle);
69
+ if (false === $pointerLocation) {
70
+ throw new \RuntimeException('unable to get current location of the file pointer. exception thrown to prevent unpredictable pointer jumping');
71
+ }
72
73
+ $this->openStream($this->filePath, $this->mode);
74
75
+ $content = stream_get_contents($this->fileHandle);
76
77
78
79
+ if ($pointerLocation > 0) {
80
+ $this->fread($pointerLocation);
81
82
83
+ return $content;
84
85
0 commit comments