• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<meta charset="utf-8" />
3<title>FormData: 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-formdata-helper.js"></script>
25<script>
26  "use strict";
27
28  formDataPostFileUploadTest({
29    fileNameSource: "ASCII",
30    fileBaseName: "file-for-upload-in-form-NUL-[\0].txt",
31  });
32
33  formDataPostFileUploadTest({
34    fileNameSource: "ASCII",
35    fileBaseName: "file-for-upload-in-form-BS-[\b].txt",
36  });
37
38  formDataPostFileUploadTest({
39    fileNameSource: "ASCII",
40    fileBaseName: "file-for-upload-in-form-VT-[\v].txt",
41  });
42
43  // These have characters that undergo processing in name=,
44  // filename=, and/or value; formDataPostFileUploadTest postprocesses
45  // expectedEncodedBaseName for these internally.
46
47  formDataPostFileUploadTest({
48    fileNameSource: "ASCII",
49    fileBaseName: "file-for-upload-in-form-LF-[\n].txt",
50  });
51
52  formDataPostFileUploadTest({
53    fileNameSource: "ASCII",
54    fileBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt",
55  });
56
57  formDataPostFileUploadTest({
58    fileNameSource: "ASCII",
59    fileBaseName: "file-for-upload-in-form-CR-[\r].txt",
60  });
61
62  formDataPostFileUploadTest({
63    fileNameSource: "ASCII",
64    fileBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt",
65  });
66
67  formDataPostFileUploadTest({
68    fileNameSource: "ASCII",
69    fileBaseName: "file-for-upload-in-form-HT-[\t].txt",
70  });
71
72  formDataPostFileUploadTest({
73    fileNameSource: "ASCII",
74    fileBaseName: "file-for-upload-in-form-FF-[\f].txt",
75  });
76
77  formDataPostFileUploadTest({
78    fileNameSource: "ASCII",
79    fileBaseName: "file-for-upload-in-form-DEL-[\x7F].txt",
80  });
81
82  // The rest should be passed through unmodified:
83
84  formDataPostFileUploadTest({
85    fileNameSource: "ASCII",
86    fileBaseName: "file-for-upload-in-form-ESC-[\x1B].txt",
87  });
88
89  formDataPostFileUploadTest({
90    fileNameSource: "ASCII",
91    fileBaseName: "file-for-upload-in-form-SPACE-[ ].txt",
92  });
93</script>
94