commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: [FileUpload] new user, querying functionality? commons-fileup load
Date Tue, 31 Aug 2004 13:18:17 GMT

    -----Original Message-----
    From: Schalk Neethling 
    How many files do you want to upload at a time? I have had 
    no problem uploading up to five at one time using either 
    five file fields or reading a directories files and loading 
    them as a list of tick boxes.

I want it to be user defined? 1..n
I have a javascript solution, recurses on a function to
add more 'single file' uploads. Works with ie6 and firefox;
just building a tomcat install to see if I can do the upload!

js below if interested:
Not tested for full accessibility yet.

regards DaveP

  <head><title>Web Toaster Sample Form</title>
  <title>Multiple File Uploads</title>

<script language="JavaScript1.2" type="text/javascript">

function bn() {
if ((browserName=="Netscape" && browserVer>=3) )

  if (browserName=="Microsoft Internet Explorer" && browserVer>=4)
return (version);


function showUpload(){
 var e=window.event || arguments.callee.caller.arguments[0];
	var obj = null;
	var position = 0;
	if (bn() == "ns"){
		obj =;
		var parentE = obj.parentNode; //the <LI>
		var Gparent = parentE.parentNode;
		obj = event.srcElement;
		var parentE = obj.parentElement; //the <LI>
		var Gparent = parentE.parentElement;
	if (obj == null) alert("Oh dear!");

	if (obj.value == " Remove this file?"){
		// delete the following sibling
		// fixup the file ids because they have to be unique?
		for (var i=0; i < Gparent.children.length; i++){
			LI = Gparent.children[i];
			var INPUT = LI.children[0];
			INPUT.setAttribute("id", "file" + i);
			INPUT.setAttribute("name", "file" + i);
		var newLI = document.createElement("li");
		var newFU = document.createElement("input");
		newFU.setAttribute("type", "file");
		var lth = 0;
		if (bn() == "ns"){
		    lth = Gparent.childNodes.length;
                else {
		    lth = Gparent.children.length;
		newFU.setAttribute("id", "file" + lth);
		         //(Gparent.children.length)); // file + end of list

		var newBU = document.createElement("input");
		newBU.type= "button";
		newBU.value= "Upload another file?";
		newBU.onclick = showUpload;

		var OL = document.getElementById("ULlist");
		if (bn() =="ns"){
		  parentE.childNodes[0].value= " Remove this file?";
		else {
		  parentE.children[1].value = " Remove this file?";



	<form enctype="multipart/form-data" method="post"
			<input type="file" name="fo"/>
			<input type="submit" value="Format..."/>

	<fieldset style="padding: 10px;">
	     <legend><b>Upload a File</b></legend><br />

		<form method="post" action="" name="form">
			<ol id="ULlist">
			     <input type="file" id="file0">
			     <input type="button"  onclick="showUpload();"

                              value="Upload another file?">
			<input type="submit" value="Submit..."/>



NOTICE: The information contained in this email and any attachments is 
confidential and may be privileged. If you are not the intended 
recipient you should not use, disclose, distribute or copy any of the 
content of it or of any attachment; you are requested to notify the 
sender immediately of your receipt of the email and then to delete it 
and any attachments from your system. 

RNIB endeavours to ensure that emails and any attachments generated by 
its staff are free from viruses or other contaminants. However, it 
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments. 

Please note that the statements and views expressed in this email and 
any attachments are those of the author and do not necessarily represent 
those of RNIB. 

RNIB Registered Charity Number: 226227 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message