5 <% include( '/elements/form-file_upload.html',
8 'action' => 'process/target.cgi', #progress-init target
9 'fields' => [ 'other', 'form', 'fields' ],
10 'num_files' => 1, #or more
14 'message' => 'Message',
17 'key' => 'unique_key', #for using more than once on a page
23 include( '/elements/file-upload.html',
30 % # num_files=>2 # or more
31 include( '/elements/file-upload.html',
32 'field' => [ 'element', 'element2', ], #etc.
33 'label' => [ 'Label', 'Label2', ], #etc.
41 <% include( '/elements/progress-init.html',
52 function <% $opt{key} %>gotUploaded(success, message) {
54 var uploaded = document.getElementById('uploaded_files');
55 var a = uploaded.value.split(',');
56 if (success && uploaded.value.split(',').length == <% $opt{num_files} %>){
59 var p = document.getElementById('uploadError');
60 p.innerHTML='<FONT SIZE="+1" COLOR="#ff0000">Error: '+message+'</FONT><BR><BR>';
61 p.style='display:visible';
69 <div style="display:none:" id="uploadError"></div>
71 <FORM NAME = "<% $opt{name} %>"
72 ACTION = "<% $fsurl %>misc/file-upload.html"
74 ENCTYPE = "multipart/form-data"
75 onSubmit = "return doUpload(this, <% $opt{key} %>gotUploaded)"
80 #my( $formname, $fields, $action, $url_or_message, $key ) = @_;
81 my %opt = ref($_[0]) ? %{ $_[0] } : @_;
83 my $key = exists $opt{key} ? $opt{key} : '';
85 push @{ $opt{fields} }, 'uploaded_files';
87 my $msg_or_url = $opt{message}
88 ? { 'message' => $opt{message},