-
-<script type="text/javascript">
+<SCRIPT TYPE="text/javascript">
function doUpload(form, callback) {
var name = 'form' + Math.floor(Math.random() * 99999); // perlize?
var d = document.createElement('DIV');
- d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+name+'" name="'+name+'" onload="uploadComplete(\''+name+'\')"></iframe>';
+ d.innerHTML = '<iframe style="display:none" src="about:blank" ' +
+ 'id="' + name + '" ' +
+ 'name="' + name + '" ' +
+ 'onload="uploadComplete(\'' + name + '\')">' +
+ '</iframe>';
document.body.appendChild(d);
var i = document.getElementById(name);
document.getElementById('r').innerHTML = d.body.innerHTML;
if (typeof(i.onComplete) == 'function') {
var p;
- if (p = d.body.innerHTML.indexOf("Freeside File Upload Successful ") >= 0) {
- var v = d.body.innerHTML.substr(p+33)
+ if (p = d.body.innerHTML.indexOf("File Upload Successful ") >= 0) {
+ var v = d.body.innerHTML.substr(p+24);
var u = document.getElementById('uploaded_files');
v = v.substr(0, v.indexOf(';'));
u.value = v;
}
}
-</script>
+<&| onload.js &>
+// force the form to submit as multipart
+var thisform = document.getElementById('uploaded_files').form;
+thisform.enctype = 'multipart/form-data';
+</&>
+</SCRIPT>
+
+<INPUT TYPE="hidden" NAME="uploaded_files" ID="uploaded_files" VALUE="" />
+
+<INPUT TYPE="hidden" NAME="upload_fields" VALUE="<% join(',', @field) %>" />
- <input type="hidden" name="uploaded_files" id="uploaded_files" value="" />
- <input type="hidden" name="upload_fields" value="<% join(',', @field) %>" />
% foreach (@field) {
- <tr>
- <th><% shift @label %></th>
- <td><input type="file" name="<% $_ %>" /></td>
- </tr>
+% if($param{'no_table'}) {
+ <% shift @label %> <INPUT TYPE="file" NAME="<% $_ %>" />
+% }
+% else {
+ <TR>
+ <TH ALIGN="<% $param{'label_align'} || 'right' %>"><% shift @label %></TH>
+ <TD><INPUT TYPE="file" NAME="<% $_ %>" /></TD>
+ </TR>
+% }
% }
- <div style="display:<% $debug ? 'visible' : 'none' %>">Debugging: <pre id="r"></pre></div>
-
-<%init>
-my %param = @_;
-my $debug = $param{'debug'};
+<DIV STYLE="display:<% $param{debug} ? 'visible' : 'none' %>">
+ Debugging: <PRE ID="r"></PRE>
+</DIV>
-my $callback = $param{'callback'} || "''";
+<%init>
-my @label = ();
-if ( ref($param{'label'}) ) {
- push @label, @{$param{'label'}};
-}else{
- push @label, $param{'label'};
-}
+my %param = @_;
-my @field = ();
-if ( ref($param{'field'}) ) {
- push @field, @{$param{'field'}};
-}else{
- push @field, $param{'field'};
-}
+my @label = ref($param{'label'}) ? @{$param{'label'}} : ($param{'label'});
+my @field = ref($param{'field'}) ? @{$param{'field'}} : ($param{'field'});
</%init>