Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
VoxEcho  
#1 Posted : Friday, January 11, 2008 6:36:15 AM(UTC)
VoxEcho

Rank: Member

Groups: Member
Joined: 4/19/2007(UTC)
Posts: 9

here is the scenerio.

I have a listener set on the BeforeUpload which will validate the form sent with the upload form. this worked great, if the form wasn't valid it would cancel the uplaod by returning false to BeforeUpload Even.

i tested in IE.7 and FireFox 2.0.0.11 - so far so good.

next i wanted to make sure that the descriptions for the files are not null, so:

i used getUploadFileCount to get the number of files. this worked
i used getUploadFileName to get the name it returns null
i used getUploadFileDescription it returns null

now this is annoying as it is, that there are returning null (any ideas why?) but here's the rub, if i touch getUploadFileName in anyway, it seems to negate the BeforeUpload listener. so even thought that listener returns false, the upload still proceeds.

Two Q's:
1. why are those properties returning null?
2. why is the event listener no longer accepting return value when the filename property is touched?

thanks
Alex Makhov  
#2 Posted : Friday, January 11, 2008 12:35:35 PM(UTC)
Alex Makhov

Rank: Advanced Member

Groups: Member
Joined: 8/3/2003(UTC)
Posts: 998

Hello,

Did you use zero or one-based indexes in getUploadFileName etc. methods? Note that the indexes are one-based.
Sincerely yours,
Alex Makhov

UserPostedImage Follow Aurigma on Twitter!
VoxEcho  
#3 Posted : Monday, January 14, 2008 1:59:54 AM(UTC)
VoxEcho

Rank: Member

Groups: Member
Joined: 4/19/2007(UTC)
Posts: 9

that would be 1 based.

Please note that it works fine for IE so the basics have been covered. else it would not work there either.

Thank you

Alex Makhov wrote:
Hello,

Did you use zero or one-based indexes in getUploadFileName etc. methods? Note that the indexes are one-based.
Alex Makhov  
#4 Posted : Monday, January 14, 2008 1:05:42 PM(UTC)
Alex Makhov

Rank: Advanced Member

Groups: Member
Joined: 8/3/2003(UTC)
Posts: 998

Hello,

OK, that was the simplest possible reason of the problem. Could you show your code or better give me the link to your problem page as a PM?
Sincerely yours,
Alex Makhov

UserPostedImage Follow Aurigma on Twitter!
lowenreg@lowen.com  
#5 Posted : Tuesday, January 15, 2008 1:38:44 AM(UTC)
lowenreg@lowen.com

Rank: Newbie

Groups: Member
Joined: 1/15/2008(UTC)
Posts: 3

here is the relevent code
Code:
// 1/11/2008:8:43 AM
function Validate_Descriptions(){
 var FilesNeedingDescriptions = new Array()
 var r = "";
 try{
  var ui = getImageUploader("ImageUploader")
 } catch(e){
  return(Validate_HTMLDescriptions())
 }
 try {
  if(ui){
   if(ns){return("");}
    var fileCount = ui.getUploadFileCount();
    var i = 0;
    var ii = 0;
    var arrFileName
    var fileName, fileDesc;
    for(i=1;i<=fileCount;i++){
     fileName = ui.getUploadFileName(i);
     if(fileName!=null){
      arrFileName = fileName.toLowerCase().split("\\");
      fileName = arrFileName[arrFileName.length-1];
     }
     fileDesc = ui.getUploadFileDescription(i);
     FilesNeedingDescriptions[FilesNeedingDescriptions.length] = {
      filename : fileName,
      description: fileDesc,
      index : i
     };
    }
   return(Validate_FileList(FilesNeedingDescriptions));
  }
 } catch(e){return("");}
 return("");
}




Alex Makhov wrote:
Hello,

OK, that was the simplest possible reason of the problem. Could you show your code or better give me the link to your problem page as a PM?

Edited by user Tuesday, January 15, 2008 1:46:41 PM(UTC)  | Reason: Not specified

George Ulyanov  
#6 Posted : Tuesday, January 15, 2008 2:31:33 PM(UTC)
George Ulyanov

Rank: Advanced Member

Groups: Member
Joined: 7/26/2006(UTC)
Posts: 203

Hello,

I have checked the part of your code and it workes perfectly:

Code:

iu.addEventListener("BeforeUpload", "__BeforeUpload");

...

function __BeforeUpload()
{
	var iu = getImageUploader("ImageUploader1")
	if(iu)
	{
		var fileCount = iu.getUploadFileCount();
		for(i = 1; i <= fileCount; i++)
		{
			fileName = iu.getUploadFileName(i);
			fileDesc = iu.getUploadFileDescription(i);
			alert(fileName);
			alert(fileDesc);
		}
	}
}



Probably the problem is in eror handling:

Code:

try{
  var ui = getImageUploader("ImageUploader")
} catch(e){
  return(Validate_HTMLDescriptions())
}


Try something like it:

Code:

function Validate_Descriptions(){
var FilesNeedingDescriptions = new Array()
var r = "";
var ui = getImageUploader("ImageUploader")
try {
  if(ui){
   if(ns){return("");}
.....
}

Edited by user Monday, February 25, 2008 3:59:54 PM(UTC)  | Reason: Not specified

Best regards,
George Ulyanov
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.