Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > Other Forums > The Voda Lounge (Chit Chat)

Notices

The Voda Lounge (Chit Chat) Introduce yourself. Open Discussions, Tell a Joke, Gossip, Chit Chat about anything. (Almost Anything:) No Web Hosting or BlueVoda talk permitted in this forum. We have plenty of other forums for that purpose. Most importantly, HAVE FUN!

Reply
 
LinkBack Thread Tools
  #1  
Old 06-23-2008, 10:34 PM
Private
 
Join Date: Jun 2008
Posts: 1
Default Missing files when uploading

Hi,

I have a script for uploading files, 3 at maximun, the problem is that when i submit only the first file is submitted the other 2 are lost, but this only happens in mozilla in IE all 3 are uploaded. Can anyone help me? This is the JS that i use:


function MultiSelector( list_target, max ){

// Where to write the list
this.list_target = list_target;
// How many elements?
this.count = 0;
// How many elements?
this.id = 0;
// Is there a maximum?
if( max ){
this.max = max;
} else {
this.max = -1;
};

/**
* Add a new file input element
*/
this.addElement = function( element){

// Make sure it's a file input element
if( element.tagName == 'INPUT' && element.type == 'file' ){

// Element name -- what number am I?
element.name = 'file_' + this.id++;

// Add reference to this object
element.multi_selector = this;

// What to do when a file is selected
element.onchange = function(){
Filename = element.value;
Extension = (Filename.substring(Filename.lastIndexOf("."))).to LowerCase();
Flag = false;
for (var i = 0; i < AllowedExtensionFile.length; i++) {
if (AllowedExtensionFile[i] == Extension) {
Flag = true;
break;
}
}
if (!Flag) {
alert(MessageInvalidExtension);//This message is in the UpdloadPhotos View
return 0;
}
// New file input
var new_element = document.createElement( 'input' );
new_element.type = 'file';

// Add new element
this.parentNode.insertBefore( new_element, this );

// Apply 'update' to element
this.multi_selector.addElement( new_element );

// Update list
this.multi_selector.addListRow( this );

// Hide this: we can't use display:none because Safari doesn't like it
this.style.position = 'absolute';
this.style.left = '-1000px';

};
// If we've reached maximum number, disable input element
if( this.max != -1 && this.count >= this.max ){
element.disabled = true;
};

if(this.count>0)
document.getElementById('ContainerFile').style.dis play = 'block';

// File element counter
this.count++;
// Most recent element
this.current_element = element;

var b = window.parent.document.getElementById('Tea');
if(b != null) {
document.getElementById('files').value = this.count;
if(this.count > 1) {
b.align = "right";
}
}

} else {
// This can only be applied to file input elements!
alert( 'Error: not a file input element' );
};
};

/**
* Add a new row to the list of files
*/
this.addListRow = function( element ){



// Row div
var new_row = document.createElement( 'div' );
var filevalue= element.value;
var filename="";
// Delete button
//var new_row_button = document.createElement( 'input' );
//new_row_button.type = 'button';
//new_row_button.value = 'Delete';

// Delete Image
var new_row_button = document.createElement( 'img' );
new_row_button.src='Images/but_delete_on.gif';


// References
new_row.element = element;

filename = filevalue;
var l = filename.length;
//Set the lenght of the filename to 50 with 10 blank spaces in the middle.

if (l > 40){
filename = filename.substring(0, 20) + '...' + filename.substring(l - 20);
}

var table = document.createElement('table');
var row = table.insertRow(0);
var img_cell = row.insertCell(0);
var img = document.createElement('img');
img.src = 'Images/but_delete_on.gif';
img_cell.appendChild(img);


img.onclick= function(){
var el = this.parentNode.parentNode.parentNode.parentNode.p arentNode.element;

el.parentNode.removeChild(el);
this.parentNode.parentNode.parentNode.parentNode.p arentNode.parentNode.removeChild(this.parentNode.p arentNode.parentNode.parentNode.parentNode);
el.multi_selector.count--;
el.multi_selector.current_element.disabled = false;

if(el.multi_selector.count == 1)
document.getElementById('ContainerFile').style.dis play = 'none';

var files = document.getElementById('files');
files.value = files.value - 1;
if(files.value - 1 == 0) {
document.getElementById('Tea').align = 'left';
}

return false;
};



var cell = row.insertCell(1);
cell.style.fontFamily = 'Verdana';
cell.style.fontSize = '10px';
cell.style.color = '#697780';
cell.style.textDecoration = 'none';
cell.style.fontWeight = 'bold';

cell.innerHTML = "&nbsp;" + filename;
new_row.appendChild(table);

this.list_target.appendChild( new_row );

};
};
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 04:01 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2007 VodaHost.com - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55