Documentation

InputFile

string
CFile::InputFile(
 string FieldName,
 int field_size,
 int ImageID,
 string ImageStorePath = false,
 int file_max_size = 0,
 string FileType = "IMAGE",
 string field_file = "class=typefile",
 int description_size = 0,
 string field_text = "class=typeinput",
 string field_checkbox = "",
 bool ShowNotes = true,
 bool ShowFilePath = True
)

The method returns the HTML form code that can be used to upload a new or replace an existing file. Static method.

Parameters

ParameterDescription Available from version
FieldName Name of the file input field:
<input type="file" name="input_file_name" ... >
field_size Width of the file input field:
<input type="file" size="input_file_width" ... >
ImageID Numerical ID of the existing file.
ImageStorePath Folder root path to store files. For example: "/upload/iblock/".
Optional parameter. False by default, which means system settings are used.
file_max_size Maximum file size (bytes):
<input type="hidden" name="MAX_FILE_SIZE" value="file_max_size">
Optional parameter. The default value is "0", no restrictions applied.
FileType File type. If "IMAGE", the file information will contain image dimensions.
Optional parameter; the default value is "IMAGE".
field_file Arbitrary HTML code to ins ert in the file input tag:
<input type="file" add_to_input_file ... >
Optional parameter. The default value is "class=typefile" - standard class for file input fields in the administrative section.
description_size Width of the file comment input field:
<input type="text" size="input_description_width" ... >
Optional parameter. The default value is "0", which hides the comment field.
field_text Arbitrary HTML code that will be added to the file comment input field:
<input type="text" add_to_input_description ... >
Optional parameter. The default value is "class=typeinput" - standard class for single string input elements in the administrative section.
field_checkbox Arbitrary HTML code that will be added to the "checkbox" field type to delete file:
<input type="checkbox" name="input_file_name_del" value="Y" add_to_checkbox_delete ... >
Optional parameter.
ShowNotes Flag that allows to enable or disable the display of file information (size, width, height).
Optional parameter. By default value is "true" - show file information.
ShowFilePath Flag that allows to enable or disable the display of path to file.
Optional parameter. By default val ue is "true" - show file information.

See Also

Examples of use

<tr valign="top">
    <td align="right"><font class="tablefieldtext"><?=GetMessage("VOTE_IMAGE")?></font></td>
    <td><font class="tablebodytext"><?
    echo CFile::InputFile("IMAGE_ID", 20, $str_IMAGE_ID);
    if (strlen($str_IMAGE_ID)>0):
        ?><br><?echo CFile::ShowImage($str_IMAGE_ID, 200, 200, "border=0", "", true);
    endif;
    ?></font>
    </td>
</tr>


© «Bitrix24», 2001-2022
Up