struct DynFork::Fields::FileField
- DynFork::Fields::FileField
- DynFork::Fields::Field
- Struct
- Value
- Object
Overview
File upload field.
NOTE How to use, see example.
Defined in:
dynfork/fields/file.crConstructors
- .new(pull : JSON::PullParser)
- .new(label : String = "", default : String | Nil = nil, target_dir : String = "files", accept : String = "", placeholder : String = "", maxsize : Int64 = 2097152, hide : Bool = false, required : Bool = false, disabled : Bool = false, readonly : Bool = false, ignored : Bool = false, hint : String = "", warning : Array(String) = Array(String).new)
Instance Method Summary
-
#accept : String
HTML attribute: accept
Describing which file types to allow. -
#default : String | Nil
Default file path.
-
#default? : String | Nil | Nil
Default file path.
-
#extract_file_data? : DynFork::Globals::FileData | Nil
For the
DynFork::QPaladins::Check#check
method. -
#extract_file_path? : String | Nil
For the
DynFork::QPaladins::Check#check
method. -
#field_type : String
Field type - Structure Name.
-
#from_base64(base64 : String | Nil = nil, filename : String | Nil = nil, delete : Bool = false) : Nil
Convert base64 to a file and save in the target directory.
-
#from_path(path : String | Nil = nil, delete : Bool = false) : Nil
Convert path to a file and save in the target directory.
-
#group : UInt8
To optimize field traversal in the
paladins/check()
method. -
#input_type : String | Nil
Html tag: input type="file".
-
#input_type? : String | Nil | Nil
Html tag: input type="file".
-
#maxsize : Int64
The maximum allowed file size in bytes.
-
#media_root : String
Root directory for storing media files.
-
#media_url : String
URL address for the media directory.
-
#placeholder : String
Displays prompt text.
-
#readonly=(readonly : Bool)
Specifies that the field cannot be modified by the user.
-
#readonly? : Bool
Specifies that the field cannot be modified by the user.
-
#refrash_val_file_data(val : DynFork::Globals::FileData) : Nil
For the
DynFork::QPaladins::Tools#refrash_fields
method. -
#required? : Bool
Required field.
-
#target_dir : String
Directory for files inside media directory.
-
#value : DynFork::Globals::FileData | Nil
Sets the value of an element.
-
#value=(value : DynFork::Globals::FileData | Nil)
Sets the value of an element.
-
#value? : DynFork::Globals::FileData | Nil | Nil
Sets the value of an element.
Instance methods inherited from struct DynFork::Fields::Field
choices_from_json(json : String) : Nil
choices_from_json,
disabled=(disabled : Bool)
disabled=,
disabled? : Bool
disabled?,
errors : Array(String)
errors,
errors=(errors : Array(String))
errors=,
field_type : String
field_type,
group : UInt8
group,
hide=(hide : Bool)
hide=,
hide? : Bool
hide?,
hint : String
hint,
id : String
id,
id=(id : String)
id=,
ignored? : Bool
ignored?,
label : String
label,
name : String
name,
name=(name : String)
name=,
slug_sources : Array(String)
slug_sources,
warning : Array(String)
warning,
warning=(warning : Array(String))
warning=
Constructor methods inherited from struct DynFork::Fields::Field
new(pull : JSON::PullParser)
new
Constructor Detail
Instance Method Detail
HTML attribute: accept
Describing which file types to allow.
Example: ".pdf,.doc,.docx,application/msword"
NOTE https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept#unique_file_type_specifiers
For the DynFork::QPaladins::Check#check
method.
Convert base64 to a file and save in the target directory. filename: Example: foo.pdf
Convert path to a file and save in the target directory.
To optimize field traversal in the paladins/check()
method.
WARNING It is recommended not to change.
The maximum allowed file size in bytes.
NOTE 1 MB = 1048576 Bytes (in binary).
For the DynFork::QPaladins::Tools#refrash_fields
method.
Directory for files inside media directory.
Examples: files|resume|reports