Wapp

Check-in [089322b3a4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhance the file upload test to show uploaded images inline.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:089322b3a4ae1b25acde2c1fba03aaee2a5106f9f7751c62930881b79d4ef18c
User & Date: drh 2018-02-06 16:36:18
Context
2018-02-06
16:54
Adjust the regexp commands used to parse multipart/form-data to improved performance with very large upload files. check-in: 4cc53a980a user: drh tags: trunk
16:36
Enhance the file upload test to show uploaded images inline. check-in: 089322b3a4 user: drh tags: trunk
15:47
Add support for decoding multipart/form-data on POST queries. check-in: 70438dc56d user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/test01.tcl.

119
120
121
122
123
124
125

126
127
128
129
130
131
132
133


















134
135
136
137
138
139
140
      <pre>
      %html($res)
      </pre>
    }
  }
}
proc wapp-page-fileupload {} {

  wapp-trim {
    <h1>Wapp Form Test</h1>
    <p><form method="POST" enctype="multipart/form-data">
    <input type="file" name="f1"><br>
    <input type="file" name="f2"><br>
    <input type="file" name="f3"><br>
    <input type="submit" value="Go">
    </form></p>


















    <pre>%html([wapp-debug-env])
    .header = %html([wapp-param .header])
    </pre>
  }
}

proc wapp-page-encodings {} {







>

|




|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
      <pre>
      %html($res)
      </pre>
    }
  }
}
proc wapp-page-fileupload {} {
  wapp-content-security-policy {default_src 'self' 'inline'}
  wapp-trim {
    <h1>Wapp File Upload Form Test</h1>
    <p><form method="POST" enctype="multipart/form-data">
    <input type="file" name="f1"><br>
    <input type="file" name="f2"><br>
    <input type="file" name="f3"><br>
    <input type="submit" value="Upload Files">
    </form></p>
  }
  foreach name {f1 f2 f3} {
    if {[wapp-param $name.filename]==""} continue
    wapp-subst {<h2>%html($name): %html([wapp-param $name.filename])</h2>\n}
    set mimetype [wapp-param $name.mimetype]
    if {[string match text/* $mimetype]} {
      wapp-subst {<pre>%html([wapp-param $name.content])</pre>\n}
    } elseif {[string match image/* $mimetype]} {
      set data [binary encode base64 [wapp-param $name.content]]
      wapp-subst {<img src="data:%url($mimetype);base64,%unsafe($data)">\n}
    } else {
      wapp-subst {<p>Unrenderable mime-type: %html($mimetype)</p>\n}
    }
    wapp-set-param $name.content \
       "... [string length [wapp-param $name.content]] bytes of data ..."
  }
  wapp-trim {
    <h2>Environment</h2>
    <pre>%html([wapp-debug-env])
    .header = %html([wapp-param .header])
    </pre>
  }
}

proc wapp-page-encodings {} {