P
P
pirate_prentice2019-12-02 12:11:56
JavaScript
pirate_prentice, 2019-12-02 12:11:56

How to get names of all attached files in input file in AMP pages?

Hello! Help, please, to understand.
I have a form on an AMP page that has an input file multiple. When attaching files, you need to output their names to the line above, or to the console from the script, that's not the point. I can get at least some data about files by contacting event.target.value in the handler, which gives the name of the last file with fakepath. Calling event.target.files returns undefined. If you output the input itself to the console, it also does not have the files parameter

<div>
        <p [text]="attached">No files attached</p>
        <form id="form" method="post" target="_top" action-xhr="/index.php" autocomplete="off" custom-validation-reporting="show-all-on-submit">
            <input id='fileloader' type="file" name="file" on="change:AMP.setState({attached: event.value})">     
            <br><br>
            <input type="submit" value="Отправить" role="button" tabindex="2" id="submit" name="Отправить">
        </form>
    </div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question