string CFile::CheckImageFile( array file, int max_size = 0, int max_width = 0, int max_height = 0 )
The method CheckImageFile ensures the file is an image and checks its parameters. In case of an error, the method returns a string containing the error description.
Parameter | Description |
---|---|
file | Array with the file information in the format:Array( "name" => "file name", "size" => "size", "tmp_name" => "temporary file path on server", "type" => "file type ", "del" => "flag (Y|N) specifying to delete" "the existing file from the database", "MODULE_ID" => "module name")This array can be obtained, for example, by joining arrays $_FILES[field_name] and Array("del" => ${"field_name"."_del"}, "MODULE_ID" = "module_name"). |
max_size | Maximum size of a file, in bytes. Optional. The default value is "0", which means no restriction applies. |
max_width | Maximum width of the image, in pixels. Optional. The default value is "0", which means no restriction applies. |
max_height | Maximum height of the image, in pixels. Optional. The default value is "0", which means no restriction applies. |
<? $arrFile = array_merge( $_FILES["ATTACHED_IMAGE"], array("del" => ${"ATTACHED_IMAGE_del"}, "MODULE_ID" => "forum")); $res = CFile::CheckImageFile($arrFile, 200, 50, 50); if (strlen($res) > 0) $strError .= $res."<br>"; ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |