Getting the filesize of a file with the help of javascript

Getting the filesize of a file with the help of javascript

am 02.06.2007 16:42:04 von mark

------=_Part_8198_22713561.1180795324372
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hey,

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.

Thanx in favor,
Mark.

------=_Part_8198_22713561.1180795324372--

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

am 02.06.2007 19:07:29 von Richard Lynch

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