Re: Getting the filesize of a file with the help of javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, June 2, 2007 9:42 am, Mark wrote:
> I`m currently making a script and i`m having the intention of getting
> it to
> work on as much hosts as possible.
> The big problem with this is that some host (mostly free hosts) turn
> off
> alot of vital functions that i need to get for
> example the filesize of a remote file (or anything remote). Now i had
> the
> idea to use some javascript ajax
> requests to a host that does support that stuff so that it`s still
> availible
> on alot hosts.. even if they have it turned off.
>
> Now i`m just wondering how you guys would go arround a problem like
> this and
> if you think the above is a good idea..?
> btw.. i have the remote filesize stuff with the help of javascript and
> ajax
> working so it`s not a impossible idea.. it`s probably just a little
> harder
> when you need to get remoe (xml) files with net security update.. or
> even
> the remote creation of thumbnails.

You could, perhaps, write various "fallback" functions to try to find
the filesize...

See if filesize(REMOTE) works.
See if curl is installed, and do a HEAD request for HTTP
If it's FTP, see if PHP has ftp functions.

You might want to use JS as a last resort, as you can't guarentee that
it will be enabled on the browser, nor that the various security
resrictions won't trip you up.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux