Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15200708
D18701.id44893.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D18701.id44893.diff
View Options
diff --git a/src/aphront/multipartparser/AphrontMultipartPart.php b/src/aphront/multipartparser/AphrontMultipartPart.php
--- a/src/aphront/multipartparser/AphrontMultipartPart.php
+++ b/src/aphront/multipartparser/AphrontMultipartPart.php
@@ -7,6 +7,8 @@
private $name;
private $filename;
+ private $tempFile;
+ private $byteSize = 0;
public function appendRawHeader($bytes) {
$parser = id(new AphrontHTTPHeaderParser())
@@ -38,10 +40,15 @@
}
public function appendData($bytes) {
+ $this->byteSize += strlen($bytes);
+
if ($this->isVariable()) {
$this->value .= $bytes;
} else {
- throw new Exception(pht('File multipart stuff is not yet supported.'));
+ if (!$this->tempFile) {
+ $this->tempFile = new TempFile(getmypid().'.upload');
+ }
+ Filesystem::appendFile($this->tempFile, $bytes);
}
return $this;
@@ -63,4 +70,27 @@
return $this->value;
}
+ public function getPHPFileDictionary() {
+ if (!$this->tempFile) {
+ $this->appendData('');
+ }
+
+ $mime_type = 'application/octet-stream';
+ foreach ($this->headers as $header) {
+ list($name, $value) = $header;
+ if (strtolower($name) == 'content-type') {
+ $mime_type = $value;
+ break;
+ }
+ }
+
+ return array(
+ 'name' => $this->filename,
+ 'type' => $mime_type,
+ 'tmp_name' => (string)$this->tempFile,
+ 'error' => 0,
+ 'size' => $this->byteSize,
+ );
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 24, 2:34 PM (8 h, 42 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7190309
Default Alt Text
D18701.id44893.diff (1 KB)
Attached To
Mode
D18701: Stream "multipart/form-data" file uploads to disk
Attached
Detach File
Event Timeline
Log In to Comment