PHP Classes

Upload problem

Recommend this page to a friend!

      AJAX File Uploader  >  All threads  >  Upload problem  >  (Un) Subscribe thread alerts  
Subject:Upload problem
Summary:Error: document.getElementById("formName" + obj.name) has no pro
Messages:4
Author:Tarik Tutuncu
Date:2006-05-24 00:53:16
Update:2006-05-25 20:20:40
 

  1. Upload problem   Reply   Report abuse  
Picture of Tarik Tutuncu Tarik Tutuncu - 2006-05-24 00:53:16
I've got this script which stand-alone works perfect. Then I integrated it into my own script and it doesn't work.
No matter how many I show or if I change the id's, the first one always complaints having an empty object.name.

I get this error:
Error: document.getElementById("formName" + obj.name) has no properties
Source File: http://www.....com/demo/uploader.js
Line: 41

I've compared the code with the stand-alone version and really can't find any differences. Also played with doc types and all that but to no avail.

Please help
Thank You

  2. Re: Upload problem   Reply   Report abuse  
Picture of Er. Rochak Chauhan Er. Rochak Chauhan - 2006-05-24 04:54:31 - In reply to message 1 from Tarik Tutuncu

Error: document.getElementById("formName" + obj.name)

The reason for this ERROR could be:

1) The name for the form is NOT "formname".
2) obj is not defined as an object.
3) The object "obj" does not name name attibute.
4) obj is defined multiple times.
5) "formname" is defined multiple times as an object id.


Please check for there errors, or send the code url.

Good luck !

  3. Re: Upload problem   Reply   Report abuse  
Picture of Tarik Tutuncu Tarik Tutuncu - 2006-05-24 13:22:10 - In reply to message 2 from Er. Rochak Chauhan
I have checked everything you said.
I got the same error even when I uploaded your script without doing any changes.
The problem is when I create 3 file upload instances with:
echo $ajaxFileUploader->showFileUploader('id1');
echo $ajaxFileUploader->showFileUploader('id2');
echo $ajaxFileUploader->showFileUploader('id4');

the first one doesn't work even if I change the id number. And also when I use only one of them it still doesn't work. I get the same error.

It shows 3 file upload forms. But the first one never works. No matter how many I show or if I change the id's, the first one always complaints having an empty object.name.

It works for all but the first form. And the other two forms act wierdly.
I have tested the script with both Firefox and IE

I've compared the code with the stand-alone version and really can't find any differences.

I guess somehow that first instance is clashing with other code on that page.

The second and third work regardless of whether you actually try the first one. The first doesn't work after successfully using the second or third either.

I have tested the first instance
it enters function uploadFile(obj)
then I put alerts for obj.name and obj.value and it shows the id name and value correctly, but when it comes to document.getElementById('formName'+obj.name).submit();
it stops and throws a javascript error.

Error: document.getElementById("formName" + obj.name) has no properties
Source File: http://***
Line: 41

Any ideas?
Thanks

  4. Re: Upload problem   Reply   Report abuse  
Picture of Tarik Tutuncu Tarik Tutuncu - 2006-05-25 20:20:40 - In reply to message 3 from Tarik Tutuncu
Hi,

I have solved the problem.
the script doesn't work if the upload form is inserted into another form.
I don't know why it does this. I have checked my own form but it doesn't contain any of the id values.