Thanks Scott, that was what I was missing. The attached .TML file demonstrates how to get the size of an image without uploading it to the server. I wanted to do it generically for all files, but I could only get it to work with images. Anthony was right, you can't get the properties of a document with a different host and prottcol. That would be too big a security hole.
In a nutshell, it works like this. The top frame has INPUT TYPE=FILE tag. An onChange handler writes an IMG tag to the bottom frame which loads the file locally. 200ms later (to give the image time to load) it gets the image.fileSize. Thanks everyone for your help. Dave Shelley > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Scott Cadillac > Sent: Monday, June 24, 2002 5:16 PM > To: Multiple recipients of list witango-talk > Subject: Re: Witango-Talk: Javascript Question > > > Hi Dave, > > I haven't tried it, but there is a 'document' property called 'fileSize', > so maybe: > > var txt = parent.otherFrame.document.fileSize; > > Of course, this may be an MSIE extension. More information is available > here: > http://msdn.microsoft.com/library/default.asp?url=/workshop/author > /dhtml/re > ference/properties/filesize.asp > (Above URL may word-wrap). > > Good luck and let us know how it goes. Cheers... > > Scott Cadillac > http://xml-extra.net > [EMAIL PROTECTED] > > http://witango.org > [EMAIL PROTECTED] > > VP, Research and Development > Plus International Corp. > 604-460-1843 > [EMAIL PROTECTED] > http://www.plusinternational.com > > Vancouver, BC, Canada > > Does your company have an Enterprise Information Portal? Check > out Salsa at > www.plusinternational.com/flash/salsa.htm > > ----- Original Message ----- > From: "Dave Shelley" <[EMAIL PROTECTED]> > To: "Multiple recipients of list witango-talk" <[EMAIL PROTECTED]> > Sent: Monday, June 24, 2002 1:55 PM > Subject: RE: Witango-Talk: Javascript Question > > > > Maybe I should explain what I'm trying to do. > > > > I'd like to check the size of an upload file on the client > machine before > > it's uploadad. I realize it's been said that it can't be done, > but that's > > never stopped me from trying before. ;) > > > > Starting with [input type=file name=theFile size=50> > > and an onChange handler that says: > > parent.hiddenFrame.location='file:\\'+theFile.value; > > This loads the file in the hiddenFrame. (Also works for > previewing gif's) > > > > Next I want to figure out how big it is. If I could get the contents, I > > could do a .length on it. > > > > So I can't user <@url>. The host and protocol are different from the > parent > > frame. I think I'm stuck. > > > > Thanks. > > Dave > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED]]On Behalf Of Ben Johansen > > > Sent: Monday, June 24, 2002 3:48 PM > > > To: Multiple recipients of list witango-talk > > > Subject: RE: Witango-Talk: Javascript Question > > > > > > > > > Just a thought, haven't thought it all the way > > > Using the @URL and populating a hidden object that JS can get to > > > > > > Ben Johansen - http://www.pcforge.com > > > Authorized Witango Reseller http://www.pcforge.com/WitangoGoodies.htm > > > Latest downloads & List Archives @ http://www.witango.ws > > > > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED]] On Behalf Of Dave Shelley > > > Sent: Monday, June 24, 2002 9:27 AM > > > To: Multiple recipients of list witango-talk > > > Subject: Witango-Talk: Javascript Question > > > > > > Is it possible to read the entire contents of one frame from within > > > another > > > frame? Something like: > > > var txt = parent.otherFrame.document.innerHTML; > > > > > > I have my doubts as this would open a huge security hole, but > I thought > > > I'd > > > ask anyway. > > > > > > Dave Shelley >
fileSize.tml
Description: Binary data
