JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 18th, 2013, 12:14 PM
chofift chofift is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 28 chofift User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 2 m 41 sec
Reputation Power: 0
Other - Document.getElementById not working in IE9

Hi guys,

I Hope you can help with this.

Code:
file = document.getElementById('fileToUpload').files[0];


This is working fine in Chrome and MF browsers, but doesn't in IE8. I get the error:
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Fri, 18 Jan 2013 18:13:52 UTC


Message: 'document.getElementById(...).files.0' is null or not an object

Why?


Thx..
Kr,
C.

Reply With Quote
  #2  
Old January 18th, 2013, 12:26 PM
chofift chofift is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 28 chofift User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 2 m 41 sec
Reputation Power: 0
I think it's OK now. I removed that (.files[0]), and then it works.

But I still can't display the content of the file.

In chrome, for example:
Code:
file.files[0].name;
works fine!! In IE8 not!


Reply With Quote
  #3  
Old January 18th, 2013, 03:08 PM
ZWEI01 ZWEI01 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 10 ZWEI01 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 54 m 13 sec
Reputation Power: 0
Are you using the onload event?
Code:
window.onload = function() {
//Your JavaScript code here.
}


Also, could you try and explain a little better what you are trying to do?

Reply With Quote
  #4  
Old January 18th, 2013, 05:56 PM
Winters Winters is offline
Super Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jul 2003
Posts: 3,874 Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 17 h 23 m 17 sec
Reputation Power: 2569
You cannot access the file, it would be (and was for a short time) a huge security hole in browsers. The only thing you can do is read the file name.
__________________
[PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

W3Fools - A W3Schools Intervention.

Reply With Quote
  #5  
Old January 19th, 2013, 04:48 AM
chofift chofift is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 28 chofift User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 2 m 41 sec
Reputation Power: 0
IE does not support Data Forms at all; I tried all possible ways I know and no way I can upload a txt using ajax instead of submit.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Other - Document.getElementById not working in IE9

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap