473,659 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3300
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_w hich_i_want_to_ get_the_size.ph p");

--
www.iuz-lab.info
Jul 17 '05 #3
John <jo**@nospam.or g> 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.ne t> <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_w hich_i_want_to_ get_the_size.ph p");

--
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.or g> 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.ne t> <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
2250
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); xml_parse_into_struct($parser, ${$val . 'XML'}, ${$val . 'XMLArray'}, $tags); xml_parser_free($parser); $myXMLArray = ${$val . 'XMLArray'}; for ($i = 1; $i < @sizeof($myXMLArray) - 1; $i++) { if ($myXMLArray) {
4
2618
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 output_handler ob_gzhandler When downloading files from servers that send gzipped data as well, I'd like to get the filesize before and after my server decompresses them.
5
1629
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(); fputs($fp,$time); fclose($fp); $fsize2 = filesize("foo.txt");
2
11693
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
2426
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 out. When using cdoSendUsingPort it goes directly to the remote email server and seems to bypass the virtual SMTP server running on the local machine (which can be stopped). This is all fine. I noticed that sending emails that exceed the...
4
5460
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 works on IE with one exception. With a first time displayed image, the script displays a size= -1 The image is displayed on the first pass. The fileSize script is located after the
3
3386
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? When it is a big file I want to see a MB size and when it is a lower file size then I want to see a kB size for example.
3
4369
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 see how to turn my filename(string) into a statement which would give me the filesize - the brain is very slow today. Any help gratefully appreciated. Dim files() As String = System.IO.Directory.GetFiles(root, patt)
2
4659
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 html files:
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8332
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.