Reply to Re: [PHP] Detect file size BEFORE upload it

Your name:

Reply:


Posted by tg-php on 10/06/05 22:29

Yeah, you're right. I didn't test that before I posted it.

Looks like you can do it as long as your clients are running Windows and you can use Active X or another Windows trick using something like JScript, but with pure Javascript it looks bleak.

I tried to use something like this:
img = New Image();
img.src = "somefile.ext"; // NOT an image file
alert(img.fileSize);

But found out that this is an IE-only trick as well. Nobody else seems to support the filesize property on image objects. Funny thing is, even in IE it didn't work. Even when I actually used an image for the file name.

Oh well.. guess that Java applet might be the best way then, to keep it cross platform and all that.

-Tg

= = = Original message = = =

tg-php@gryffyndevelopment.com wrote:
> var myFile = new File("c:\temp\myfile.txt");
> myFile.open("r");
> alert('myFile length: ' + myFile.getLength());

Somehow I don't think any browser is going to give JS access to
arbitrary files on the user's system like that.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация