This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
athttpd file upload wip
- From: "Øyvind Harboe" <oyvind dot harboe at zylin dot com>
- To: "eCos Discussion" <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 15 Nov 2007 08:39:27 +0100
- Subject: [ECOS] athttpd file upload wip
I've tried this on IE & Firefox and it works. I'll have to do
something about the
performance for it to be usable in our product. This is the first time
I've implemented
this sort of thing, so the code does have some of that elegance that stems from
discovering how things work and doing a first implementation :-)
This Jim Tcl script implements a file upload test page:
set form_filename [formfetch form_filename];
set form_action [formfetch form_action];
set form_filecontent [formfetch form_filecontent];
set post ""
catch {set post $post_data} err
puts "Post data: $post"
puts "Action $form_action"
set data ""
append data {<html><body><form enctype="multipart/form-data"
action="upload.tcl" method="post">}
if {[string compare $form_action "Upload"]==0} {
set fp [aio.open $form_filename w];
$fp puts -nonewline $form_filecontent
$fp close
append data "<br>Wrote $form_filename, [string length
$form_filecontent] bytes<br>"
}
append data {<a href="index.tcl">Main menu</a><br>}
append data {File upload...<br>}
append data {Filename: <input type="text" name="form_filename"> <br>}
append data {<input type="file" name="form_filecontent"> <br>}
append data {<input type="submit" name="form_action" value="Upload" ><br> }
append data {</form></body></html> }
start_chunked "html";
write_chunked $data;
end_chunked;
--
Øyvind Harboe
http://www.zylin.com - eCos ARM & FPGA developer kit
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss