File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ url = var ('request .url ')
2+
3+ if (var ('$request .method $') != 'POST ') {
4+ respond ('
5+ <html >
6+ <head ><title >Upload CSV </title ></head >
7+ <body >
8+ <h1 >Upload CSV </h1 >
9+ <form action ="{}" method ="POST " enctype ="multipart /form -data ">
10+ <input type ="file " name ="file "/>
11+ <button type ="submit ">Upload </button >
12+ </form >
13+ </body >
14+ </html >
15+ '.format (url ))
16+ }
17+
18+ array = csv_to_array (var ('request .file .file .content '), ',', 0 )
19+
20+ if (!array or array .length () < 2 ) {
21+ respond ('
22+ <h1 >Could not parse CSV </h1 >
23+ <a href ="{}">Upload again </a >
24+ '.format (url ));
25+ }
26+
27+ respond ('
28+ <h1 >Upload successful </h1 >
29+ <pre >{}</pre >
30+ <p >
31+ <a href ="{}">Upload again </a >
32+ </p >
33+ '.format (json_encode (array ), url ))
You can’t perform that action at this time.
0 commit comments