• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<meta charset="utf-8" />
3<title>Upload files named using controls (tentative)</title>
4<!--
5    NOTE: This test is tentative because encoding for filename
6    control characters is not yet standardized.
7  -->
8<link
9  rel="help"
10  href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"
11/>
12<link
13  rel="help"
14  href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"
15/>
16<link rel="help" href="https://w3c.github.io/FileAPI/#file-constructor" />
17<link
18  rel="author"
19  title="Benjamin C. Wiley Sittler"
20  href="mailto:bsittler@chromium.org"
21/>
22<script src="/resources/testharness.js"></script>
23<script src="/resources/testharnessreport.js"></script>
24<script src="../support/send-file-form-helper.js"></script>
25<script>
26  "use strict";
27
28  formPostFileUploadTest({
29    fileNameSource: "ASCII",
30    fileBaseName: "file-for-upload-in-form-NUL-[\0].txt",
31    formEncoding: "UTF-8",
32    expectedEncodedBaseName: "file-for-upload-in-form-NUL-[\0].txt",
33  });
34
35  formPostFileUploadTest({
36    fileNameSource: "ASCII",
37    fileBaseName: "file-for-upload-in-form-BS-[\b].txt",
38    formEncoding: "UTF-8",
39    expectedEncodedBaseName: "file-for-upload-in-form-BS-[\b].txt",
40  });
41
42  formPostFileUploadTest({
43    fileNameSource: "ASCII",
44    fileBaseName: "file-for-upload-in-form-VT-[\v].txt",
45    formEncoding: "UTF-8",
46    expectedEncodedBaseName: "file-for-upload-in-form-VT-[\v].txt",
47  });
48
49  // These have characters that undergo processing in name=,
50  // filename=, and/or value; formPostFileUploadTest postprocesses
51  // expectedEncodedBaseName for these internally.
52
53  formPostFileUploadTest({
54    fileNameSource: "ASCII",
55    fileBaseName: "file-for-upload-in-form-LF-[\n].txt",
56    formEncoding: "UTF-8",
57    expectedEncodedBaseName: "file-for-upload-in-form-LF-[\n].txt",
58  });
59
60  formPostFileUploadTest({
61    fileNameSource: "ASCII",
62    fileBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt",
63    formEncoding: "UTF-8",
64    expectedEncodedBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt",
65  });
66
67  formPostFileUploadTest({
68    fileNameSource: "ASCII",
69    fileBaseName: "file-for-upload-in-form-CR-[\r].txt",
70    formEncoding: "UTF-8",
71    expectedEncodedBaseName: "file-for-upload-in-form-CR-[\r].txt",
72  });
73
74  formPostFileUploadTest({
75    fileNameSource: "ASCII",
76    fileBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt",
77    formEncoding: "UTF-8",
78    expectedEncodedBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt",
79  });
80
81  formPostFileUploadTest({
82    fileNameSource: "ASCII",
83    fileBaseName: "file-for-upload-in-form-HT-[\t].txt",
84    formEncoding: "UTF-8",
85    expectedEncodedBaseName: "file-for-upload-in-form-HT-[\t].txt",
86  });
87
88  formPostFileUploadTest({
89    fileNameSource: "ASCII",
90    fileBaseName: "file-for-upload-in-form-FF-[\f].txt",
91    formEncoding: "UTF-8",
92    expectedEncodedBaseName: "file-for-upload-in-form-FF-[\f].txt",
93  });
94
95  formPostFileUploadTest({
96    fileNameSource: "ASCII",
97    fileBaseName: "file-for-upload-in-form-DEL-[\x7F].txt",
98    formEncoding: "UTF-8",
99    expectedEncodedBaseName: "file-for-upload-in-form-DEL-[\x7F].txt",
100  });
101
102  // The rest should be passed through unmodified:
103
104  formPostFileUploadTest({
105    fileNameSource: "ASCII",
106    fileBaseName: "file-for-upload-in-form-ESC-[\x1B].txt",
107    formEncoding: "UTF-8",
108    expectedEncodedBaseName: "file-for-upload-in-form-ESC-[\x1B].txt",
109  });
110
111  formPostFileUploadTest({
112    fileNameSource: "ASCII",
113    fileBaseName: "file-for-upload-in-form-SPACE-[ ].txt",
114    formEncoding: "UTF-8",
115    expectedEncodedBaseName: "file-for-upload-in-form-SPACE-[ ].txt",
116  });
117</script>
118