473,395 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

filesize

Hi all,

I'd like to evaluate dynamicaly the size of a dynamic file.
I use the filesize() function...

this is my code :
$my_size =
filesize(http://localhost/the_file_from_which...t_the_size.php) ;

=> I always get 0 !
Do you have any solution ?

thanks in advance,

--
john
Jul 17 '05 #1
6 3281
Hello,

On 10/02/2004 03:29 PM, John wrote:
I'd like to evaluate dynamicaly the size of a dynamic file.
I use the filesize() function...

this is my code :
$my_size =
filesize(http://localhost/the_file_from_which...t_the_size.php) ;

=> I always get 0 !
Do you have any solution ?


if the page is generated dynamically, the only solution is to retrieve
it and count the number of bytes in it.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #2
iuz
John wrote:
Hi all,

I'd like to evaluate dynamicaly the size of a dynamic file.
I use the filesize() function...

this is my code :
$my_size =
filesize(http://localhost/the_file_from_which...t_the_size.php)
; [..] --
john


you forget the '"' and you must declarate the file name in the following
form.. try this..
(if the script is in the same directory of the file you want to examine)
$my_size = filesize("./the_file_from_which_i_want_to_get_the_size.php");

--
www.iuz-lab.info
Jul 17 '05 #3
John <jo**@nospam.org> wrote:
Hi all,

I'd like to evaluate dynamicaly the size of a dynamic file.
I use the filesize() function...

this is my code :
$my_size =
filesize(http://localhost/the_file_from_which...t_the_size.php) ;

=> I always get 0 !
Do you have any solution ?

thanks in advance,


<http://php.net/filesize> clearly states:
| *Tip:* As of PHP 5.0.0 this function can also be used with /some/ URL
| wrappers. Refer to _Appendix L_ for a listing of which wrappers support
| *_stat()_* family of functionality.

Now Appendix L on HTTP(S) <http://php.net/wrappers.http>:
| Attribute Supported
| Restricted by allow_url_fopen. Yes
| Allows Reading Yes
| Allows Writing No
| Allows Appending No
| Allows Simultaneous Reading and Writing N/A
| Supports stat() No <-- LOOK HERE!
| Supports unlink() No
| Supports rename() No
| Supports mkdir() No
| Supports rmdir() No

A simple RTFM gives the answer... nice, huh?
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #4
> <http://php.net/filesize> clearly states:
| *Tip:* As of PHP 5.0.0 this function can also be used with /some/ URL
| wrappers. Refer to _Appendix L_ for a listing of which wrappers support
| *_stat()_* family of functionality.

Now Appendix L on HTTP(S) <http://php.net/wrappers.http>:
| Attribute Supported
| Restricted by allow_url_fopen. Yes
| Allows Reading Yes
| Allows Writing No
| Allows Appending No
| Allows Simultaneous Reading and Writing N/A
| Supports stat() No <-- LOOK HERE!
| Supports unlink() No
| Supports rename() No
| Supports mkdir() No
| Supports rmdir() No

A simple RTFM gives the answer... nice, huh?


I already RTFM... but my Php version is 4.3.8 :-/
anyway, thx for you help.

--
john
Jul 17 '05 #5
>
you forget the '"' and you must declarate the file name in the following
form.. try this..
(if the script is in the same directory of the file you want to examine)
$my_size = filesize("./the_file_from_which_i_want_to_get_the_size.php");

--
www.iuz-lab.info


The trouble is that the Php file read locally is 3 kb as it is some 8 to 10
kb when interpreted...

--
john
Jul 17 '05 #6
John <jo**@nospam.org> wrote:
<http://php.net/filesize> clearly states:
| *Tip:* As of PHP 5.0.0 this function can also be used with /some/ URL
| wrappers. Refer to _Appendix L_ for a listing of which wrappers support
| *_stat()_* family of functionality.

Now Appendix L on HTTP(S) <http://php.net/wrappers.http>:
| Attribute Supported
| Restricted by allow_url_fopen. Yes
| Allows Reading Yes
| Allows Writing No
| Allows Appending No
| Allows Simultaneous Reading and Writing N/A
| Supports stat() No <-- LOOK HERE!
| Supports unlink() No
| Supports rename() No
| Supports mkdir() No
| Supports rmdir() No

A simple RTFM gives the answer... nice, huh?


I already RTFM... but my Php version is 4.3.8 :-/
anyway, thx for you help.


Then the first part on its own suffices as your way to enlightment...
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil Powell | last post by:
// PROCESS XML CONTENT INTO DYNAMICALLY-NAMED ARRAYS foreach (array('mime', 'state', 'country') as $val) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);...
4
by: Marek Möhling | last post by:
My server (Apache/1.3.28 - PHP/4.3.3) is configured to receive gzipped data via: Header append Accept-Encoding "gzip, deflate" PHP is configured to send gzipped data via: php_value...
5
by: David | last post by:
Not sure whether this is something Im doing wrong or just something the filesize() function doesnt support but... <? $fsize1 = filesize("foo.txt"); $fp = fopen("foo.txt",a); $time = time();...
2
by: IWP506 | last post by:
I just CANNOT figure out what is wrong with this! ------ $op1f = fopen("./test.txt","r"); $op1 = fread($op1f, filesize($op1f)); ------
2
by: Alan Howard | last post by:
Just migrating some code from CDONTS to CDO and noticed some behaviour I want to verify. When using cdoSendUsingPickup the outgoing email spools to the local filesystem first before being routed...
4
by: Ken | last post by:
I would like to measure the fileSize of the image (without uploading it - php). I use: var size_pic = document.getElementById('num1').childNodes.fileSize; alert("size = " + size_pic); which...
3
by: Arjen | last post by:
Hello, When I have read a file with x.xxx.xxx.xxx bytes it is sometimes handy to show it in an diverent format than bytes. Is there a handy way to do this? Or is there a function for it? ...
3
by: mosscliffe | last post by:
I get a list of filenames from a directory with the following code, but I can not work out how to get the filesize of the filename I have just found. I guess it is fileinfo.length, but I can not...
2
by: Eric Layman | last post by:
I have checked this setting in my php.ini allow_url_fopen = On It is ON be default. According to the PHP documentation: it stated that as of php5, filesize supports the reading of remote...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.