Re: Getting the filesize of a file with the help of javascript
| From: | Richard Lynch | Date: | Sat, 02 Jun 2007 17:07:29 +0000 |
| Subject: | Re: Getting the filesize of a file with the help of javascript | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256007@lists.php.net to get a copy of this message | ||
On Sat, June 2, 2007 9:42 am, Mark wrote:
> I
m currently making a script and im 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 its not a impossible idea.. its 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?