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