Question: I uploaded some files to a folder, and when I use filesize function I get this message:

```
Message: filesize() [function.filesize]: stat failed for http://www.books.tahasoft.com/216.ppt

```

the path of file is: 

```
http://www.books.tahasoft.com/216.ppt

```

and here is my code:

```
<?
echo filesize("http://www.books.tahasoft.com/216.ppt");
?>

```

How can I fix this?

Answer: 
The `http://` stream wrapper [does not support](http://www.php.net/manual/en/wrappers.http.php) the `stat` family of functions, so you can't do this with `filesize` as the documentation warns:

> 
> As of PHP 5.0.0, this function can also be used with *some* URL
>  wrappers. Refer to Supported Protocols and Wrappers to determine which
>  wrappers support stat() family of functionality.
> 
> 
> 

If you need the filesize over HTTP without having to download the whole file first, you might be able to get it using `curl`; you can see how to do that [here](https://stackoverflow.com/questions/5440270/serving-file-hosted-on-another-server-as-download/5440303#5440303). But keep in mind that this is dependent on what headers the remote server decides to send back; there is *no guarantee* that it will always work.
for getting the size of your file from filesize() function, you need to add folder path of the file to get the size.

==> False Method: $filePath = "<http://www.books.tahasoft.com/216.ppt>";

==> True Method: folder path like: $filePath = '/home/www/uploadpath/filename';

So, you get the result by calling the function like:

filesize($filePath);

OR

If you want to get the size from the link, you have to do like this:

strlen(file\_get\_contents("<http://www.books.tahasoft.com/216.ppt>"));