Page MenuHomePhorge

final class ArcanistFileDataRef
libphutil Technical Documentation ()

Reference to a file or block of file data which can be uploaded using ArcanistFileUploader.

You can either upload a file on disk by using setPath(), or upload a block of data in memory by using setData().

For usage examples, see ArcanistFileUploader.

After uploading, successful uploads will have getPHID() populated. Failed uploads will have getErrors() populated with a description of reasons for failure.

Tasks

Configuring File References

  • public function setName($name) — Set a human-readable display filename, like "file.jpg".
  • public function getName()
  • public function setData($data) — Set the data to upload as a single raw blob.
  • public function getData()
  • public function setPath($path) — Set the data to upload by pointing to a file on disk.
  • public function getPath()
  • public function setViewPolicy($view_policy)
  • public function getViewPolicy()
  • public function setDeleteAfterEpoch($epoch) — Configure a file to be temporary instead of permanent.
  • public function getDeleteAfterEpoch()

Handling Upload Results

Uploader API

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function setName($name)

Set a human-readable display filename, like "file.jpg".

This name does not correspond to a path on disk, and is purely for human consumption.

Parameters
string$nameFilename.
Return
this

public function getName()

This method is not documented.
Return
wild

public function setData($data)

Set the data to upload as a single raw blob.

You can specify file data by calling this method with a single blob of data, or by calling setPath() and providing a path to a file on disk.

Parameters
bytes$dataBlob of file data.
Return
wild

public function getData()

This method is not documented.
Return
wild

public function setPath($path)

Set the data to upload by pointing to a file on disk.

You can specify file data by calling this method with a path, or by providing a blob of raw data to setData().

The path itself only provides data. If you want to name the file, you should also call setName().

Parameters
string$pathPath on disk to a file containing data to upload.
Return
this

public function getPath()

This method is not documented.
Return
wild

public function setViewPolicy($view_policy)

This method is not documented.
Parameters
$view_policy
Return
wild

public function getViewPolicy()

This method is not documented.
Return
wild

public function setDeleteAfterEpoch($epoch)

Configure a file to be temporary instead of permanent.

By default, files are retained indefinitely until explicitly deleted. If you want to upload a temporary file instead, you can specify an epoch timestamp. The file will be deleted after this time.

Parameters
int$epochEpoch timestamp to retain the file until.
Return
this

public function getDeleteAfterEpoch()

This method is not documented.
Return
wild

public function getErrors()

This method is not documented.
Return
wild

public function getPHID()

This method is not documented.
Return
wild

public function willUpload()

This method is not documented.
Return
wild

public function didFail($error)

This method is not documented.
Parameters
$error
Return
wild

public function setPHID($phid)

This method is not documented.
Parameters
$phid
Return
wild

public function getByteSize()

This method is not documented.
Return
wild

public function getContentHash()

This method is not documented.
Return
wild

public function didUpload()

This method is not documented.
Return
wild

public function readBytes($start, $end)

This method is not documented.
Parameters
$start
$end
Return
wild

private function newFileHash($path)

This method is not documented.
Parameters
$path
Return
wild

private function newDataHash($data)

This method is not documented.
Parameters
$data
Return
wild