Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/storage/PhabricatorFile.php
| Show First 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | public static function newChunkedFile( | ||||
| PhabricatorFileStorageEngine $engine, | PhabricatorFileStorageEngine $engine, | ||||
| $length, | $length, | ||||
| array $params) { | array $params) { | ||||
| $file = self::initializeNewFile(); | $file = self::initializeNewFile(); | ||||
| $file->setByteSize($length); | $file->setByteSize($length); | ||||
| // TODO: We might be able to test the first chunk in order to figure | // NOTE: Once we receive the first chunk, we'll detect its MIME type and | ||||
| // this out more reliably, since MIME detection usually examines headers. | // update the parent file. This matters for large media files like video. | ||||
| // However, enormous files are probably always either actually raw data | |||||
| // or reasonable to treat like raw data. | |||||
| $file->setMimeType('application/octet-stream'); | $file->setMimeType('application/octet-stream'); | ||||
| $chunked_hash = idx($params, 'chunkedHash'); | $chunked_hash = idx($params, 'chunkedHash'); | ||||
| if ($chunked_hash) { | if ($chunked_hash) { | ||||
| $file->setContentHash($chunked_hash); | $file->setContentHash($chunked_hash); | ||||
| } else { | } else { | ||||
| // See PhabricatorChunkedFileStorageEngine::getChunkedHash() for some | // See PhabricatorChunkedFileStorageEngine::getChunkedHash() for some | ||||
| // discussion of this. | // discussion of this. | ||||
| ▲ Show 20 Lines • Show All 1,173 Lines • Show Last 20 Lines | |||||