NAME
HTML::Object::DOM::FileList - HTML Object DOM FileList Class
SYNOPSIS
my
$list
= HTML::Object::DOM::FileList->new ||
die
( HTML::Object::DOM::FileList->error,
"\n"
);
<input id=
"fileItem"
type=
"file"
/>
my
$file
=
$doc
->getElementById(
'fileItem'
)->files->[0];
VERSION
v0.2.0
DESCRIPTION
An object of this type is returned by the "files" in HTML::Object::DOM::Element::Input property of the HTML <input
> element; this lets you access a list of files you would have set or added, removed, etc.. It inherits from Module::Generic::Array
Normally, under JavaScript, those files are selected with the <input type="file" /
> element. It is also used on the web for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object on Mozilla for details on this usage.
PROPERTIES
length
Read-only.
Returns the number of files in the list.
METHODS
item
Returns a HTML::Object::DOM::File object representing the file at the specified index in the file list.
Example:
# fileInput is an HTML input element: <input type="file" id="myfileinput" multiple />
my
$fileInput
=
$doc
->getElementById(
"myfileinput"
);
# files is a FileList object (similar to NodeList)
my
$files
=
$fileInput
->files;
my
$file
;
# loop through files
for
(
my
$i
= 0;
$i
<
$files
->
length
;
$i
++ )
{
# get item
$file
=
$files
->item(
$i
);
# or
$file
=
$files
->[
$i
];
say
(
$file
->name );
}
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
COPYRIGHT & LICENSE
Copyright(c) 2021 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.