| <!DOCTYPE html> | |
| <meta charset="utf-8" /> | |
| <title>Upload files named using controls</title> | |
| <link | |
| rel="help" | |
| href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data" | |
| /> | |
| <link | |
| rel="help" | |
| href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist" | |
| /> | |
| <link rel="help" href="https://w3c.github.io/FileAPI/#file-constructor" /> | |
| <link | |
| rel="author" | |
| title="Benjamin C. Wiley Sittler" | |
| href="mailto:bsittler@chromium.org" | |
| /> | |
| <script src="/resources/testharness.js"></script> | |
| <script src="/resources/testharnessreport.js"></script> | |
| <script src="../support/send-file-form-helper.js"></script> | |
| <script> | |
| "use strict"; | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-NUL-[\0].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-NUL-[\0].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-BS-[\b].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-BS-[\b].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-VT-[\v].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-VT-[\v].txt", | |
| }); | |
| // These have characters that undergo processing in name=, | |
| // filename=, and/or value; formPostFileUploadTest postprocesses | |
| // expectedEncodedBaseName for these internally. | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-LF-[\n].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-LF-[\n].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-CR-[\r].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-CR-[\r].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-HT-[\t].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-HT-[\t].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-FF-[\f].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-FF-[\f].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-DEL-[\x7F].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-DEL-[\x7F].txt", | |
| }); | |
| // The rest should be passed through unmodified: | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-ESC-[\x1B].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-ESC-[\x1B].txt", | |
| }); | |
| formPostFileUploadTest({ | |
| fileNameSource: "ASCII", | |
| fileBaseName: "file-for-upload-in-form-SPACE-[ ].txt", | |
| formEncoding: "UTF-8", | |
| expectedEncodedBaseName: "file-for-upload-in-form-SPACE-[ ].txt", | |
| }); | |
| </script> |