Bitrix Site Manager

CFile::MakeFileArray

array
CFile::MakeFileArray(
 mixed file,
 mixed mime_type = false
)

The method MakeFileArray creates an array describing a single file. Structure of the array is similar to that of $_FILES[name] (or $HTTP_POST_FILES[name]). This array can be used with methods SaveFile, CheckFile, CheckImageFile. The array returned has the following format:

Array(
    "name" => "file name",
    "size" => "size",
    "tmp_name" => "temporary path on server",
    "type" => "file type")

Parameters

ParameterDescription
file Can be one of the following values:
  • ID of the file registered with CFile;
  • fully qualified file path (relative to disk root);
  • URL of an external file (on other server).
mime_type File MIME type (e.g. "image/gif").

Optional. The default value is "false", which means the MIME type is to be determined automatically.

See Also

Example



<?
$arFile = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"]."/images/screen.gif");
$arFile["MODULE_ID"] = "support";
$arFields = array(
  "CREATED_MODULE_NAME"   => "mail",
  "MODIFIED_MODULE_NAME"  => "mail",
  "OWNER_SID"             => "user@mail.com",
  "SOURCE_SID"            => "email",
  "MESSAGE_AUTHOR_SID"    => "user@mail.com",
  "MESSAGE_SOURCE_SID"    => "email",
  "TITLE"                 => "title",
  "MESSAGE"               => "message"
  "FILES"                 => array($arFile)
  );
//$TICKET_ID = 866;
$NEW_TICKET_ID = CTicket::Set($arFields, $MESSAGE_ID, $TICKET_ID, "N");
?>