Re: [PHP] filesize() fails on file and works on it's copy (same permissions, same directory)

2013-09-23 Thread Negin Nickparsa
regardless of you, saying they have same permissions I think they do not
have the same permission

try to use --reference for chmod to see if there is any differences

try to copy the file keeping the whole permissions from original using sudo
cp -rp and check.
if this copy has the warning then your problem is from the permissions.


Sincerely
Negin Nickparsa


On Tue, Aug 13, 2013 at 11:30 AM, Michał Kochanowicz
mic...@michal.waw.plwrote:

 Hello

 I've got a file, which can't be checked with filesize(). I copy it (with
 permissions) and then I can filesize() the copy. This is same directory,
 permissions are same. I don't understand what's the difference. Can you
 help me?

 Original file:
   File: 'DSC_5196_fx-1553725666.JPG'
   Size: 1907383 Blocks: 3728   IO Block: 4096   regular file
 Device: 803h/2051d  Inode: 5905591363  Links: 1
 Access: (0644/-rw-r--r--)  Uid: (   51/http)   Gid: (   51/http)
 Access: 2013-08-13 00:47:28.107477918 +0200
 Modify: 2013-08-12 21:38:27.219913208 +0200
 Change: 2013-08-13 00:47:08.931478654 +0200
  Birth: -

 Copy:
   File: 'DSC_5196_fx-1553725666_X.JPG'
   Size: 1907383 Blocks: 3728   IO Block: 4096   regular file
 Device: 803h/2051d  Inode: 144 Links: 1
 Access: (0644/-rw-r--r--)  Uid: (   51/http)   Gid: (   51/http)
 Access: 2013-08-13 00:45:48.0 +0200
 Modify: 2013-08-12 21:38:27.0 +0200
 Change: 2013-08-13 00:47:28.199477914 +0200
  Birth: -

 The only difference is inode: (5905591363 - doesn't work vs 144 - does
 work).

 Test script:

 html
 body
 pre
 ?
 $f3 = '/home/services/httpd/html.**galeria.XXX/gallery/var/**
 albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**
 DSC_5196_fx-1553725666.JPG';
 $f4 = '/home/services/httpd/html.**galeria.XXX/gallery/var/**
 albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**
 DSC_5196_fx-1553725666_X.JPG';

 print $f3.: .filesize($f3).\n;
 print $f4.: .filesize($f4).\n;

 ?
 /pre
 /body
 /html

 Result:

 Warning: filesize(): stat failed for /home/services/httpd/html.**
 galeria.XXX/gallery/var/**albums/988_Rok-2013/333_**
 Rydzewo-04-06.08.2013/Sobota/**DSC_5196_fx-1553725666.JPG in
 /home/services/httpd/html.**galeria.michal.waw.pl/**
 gallery3-3.0.x/test.phphttp://html.galeria.michal.waw.pl/gallery3-3.0.x/test.phpon
  line 13
 /home/services/httpd/html.**galeria.XXX/gallery/var/**
 albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**DSC_5196_fx-1553725666.JPG:

 /home/services/httpd/html.**galeria.XXX/gallery/var/**
 albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**DSC_5196_fx-1553725666_X.JPG:
 1907383

 Regards
 Michał

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] filesize() fails on file and works on it's copy (same permissions, same directory)

2013-09-23 Thread Carsten Jensen

if you have console access and the cli version of php works,
what does

echo filesize('/path/to/file');

tell (try running as root, then later as uid 51/webuser)
this will eliminate permission doubts

also you should use ?php as start tag instead of only ?

cheers
Carsten


On 09/23/2013 10:06 AM, Negin Nickparsa wrote:

regardless of you, saying they have same permissions I think they do not
have the same permission

try to use --reference for chmod to see if there is any differences

try to copy the file keeping the whole permissions from original using sudo
cp -rp and check.
if this copy has the warning then your problem is from the permissions.


Sincerely
Negin Nickparsa


On Tue, Aug 13, 2013 at 11:30 AM, Michał Kochanowicz
mic...@michal.waw.plwrote:


Hello

I've got a file, which can't be checked with filesize(). I copy it (with
permissions) and then I can filesize() the copy. This is same directory,
permissions are same. I don't understand what's the difference. Can you
help me?

Original file:
   File: 'DSC_5196_fx-1553725666.JPG'
   Size: 1907383 Blocks: 3728   IO Block: 4096   regular file
Device: 803h/2051d  Inode: 5905591363  Links: 1
Access: (0644/-rw-r--r--)  Uid: (   51/http)   Gid: (   51/http)
Access: 2013-08-13 00:47:28.107477918 +0200
Modify: 2013-08-12 21:38:27.219913208 +0200
Change: 2013-08-13 00:47:08.931478654 +0200
  Birth: -

Copy:
   File: 'DSC_5196_fx-1553725666_X.JPG'
   Size: 1907383 Blocks: 3728   IO Block: 4096   regular file
Device: 803h/2051d  Inode: 144 Links: 1
Access: (0644/-rw-r--r--)  Uid: (   51/http)   Gid: (   51/http)
Access: 2013-08-13 00:45:48.0 +0200
Modify: 2013-08-12 21:38:27.0 +0200
Change: 2013-08-13 00:47:28.199477914 +0200
  Birth: -

The only difference is inode: (5905591363 - doesn't work vs 144 - does
work).

Test script:

html
body
pre
?
$f3 = '/home/services/httpd/html.**galeria.XXX/gallery/var/**
albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**
DSC_5196_fx-1553725666.JPG';
$f4 = '/home/services/httpd/html.**galeria.XXX/gallery/var/**
albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**
DSC_5196_fx-1553725666_X.JPG';

print $f3.: .filesize($f3).\n;
print $f4.: .filesize($f4).\n;

?
/pre
/body
/html

Result:

Warning: filesize(): stat failed for /home/services/httpd/html.**
galeria.XXX/gallery/var/**albums/988_Rok-2013/333_**
Rydzewo-04-06.08.2013/Sobota/**DSC_5196_fx-1553725666.JPG in
/home/services/httpd/html.**galeria.michal.waw.pl/**
gallery3-3.0.x/test.phphttp://html.galeria.michal.waw.pl/gallery3-3.0.x/test.phpon
 line 13
/home/services/httpd/html.**galeria.XXX/gallery/var/**
albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**DSC_5196_fx-1553725666.JPG:

/home/services/httpd/html.**galeria.XXX/gallery/var/**
albums/988_Rok-2013/333_**Rydzewo-04-06.08.2013/Sobota/**DSC_5196_fx-1553725666_X.JPG:
1907383

Regards
Michał

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() fails on file and works on it's copy (same permissions, same directory)

2013-09-23 Thread Tamara Temple

On Aug 13, 2013, at 3:00 AM, Michał Kochanowicz mic...@michal.waw.pl wrote:

 Hello
 
 I've got a file, which can't be checked with filesize(). I copy it (with 
 permissions) and then I can filesize() the copy. This is same directory, 
 permissions are same. I don't understand what's the difference. Can you help 
 me?
 
 Original file:
  File: 'DSC_5196_fx-1553725666.JPG'
  Size: 1907383 Blocks: 3728   IO Block: 4096   regular file
 Device: 803h/2051d  Inode: 5905591363  Links: 1
 Access: (0644/-rw-r--r--)  Uid: (   51/http)   Gid: (   51/http)
 Access: 2013-08-13 00:47:28.107477918 +0200
 Modify: 2013-08-12 21:38:27.219913208 +0200
 Change: 2013-08-13 00:47:08.931478654 +0200
 Birth: -
 
 Copy:
  File: 'DSC_5196_fx-1553725666_X.JPG'
  Size: 1907383 Blocks: 3728   IO Block: 4096   regular file
 Device: 803h/2051d  Inode: 144 Links: 1
 Access: (0644/-rw-r--r--)  Uid: (   51/http)   Gid: (   51/http)
 Access: 2013-08-13 00:45:48.0 +0200
 Modify: 2013-08-12 21:38:27.0 +0200
 Change: 2013-08-13 00:47:28.199477914 +0200
 Birth: -
 
 The only difference is inode: (5905591363 - doesn't work vs 144 - does work).
 
 Test script:
 
 html
 body
 pre
 ?
 $f3 = 
 '/home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666.JPG';
 $f4 = 
 '/home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666_X.JPG';
 
 print $f3.: .filesize($f3).\n;
 print $f4.: .filesize($f4).\n;
 
 ?
 /pre
 /body
 /html
 
 Result:
 
 Warning: filesize(): stat failed for 
 /home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666.JPG
  in /home/services/httpd/html.galeria.michal.waw.pl/gallery3-3.0.x/test.php 
 on line 13
 /home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666.JPG:
  
 /home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666_X.JPG:
  1907383
 
 Regards
 Michał
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


That is one whopping-big inode number — I am really out on a limb here, but is 
this a 32-bit vs 64-bit issue?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() fails on file and works on it's copy (same permissions, same directory)

2013-09-23 Thread Michał Kochanowicz

W dniu 2013-09-23 10:06, Negin Nickparsa pisze:

regardless of you, saying they have same permissions I think they do not have
the same permission


The reason was 64-bit inode number. PHP can't stat() files with 64-bit nodes, 
at lease on 32-bit system.


Regards
Michał


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() fails on file and works on it's copy (same permissions, same directory)

2013-09-23 Thread Michał Kochanowicz

W dniu 2013-09-23 17:24, Tamara Temple pisze:

That is one whopping-big inode number — I am really out on a limb here, but is 
this a 32-bit vs 64-bit issue?



You're right - 64-bit inode number was a cause. I had to add inode32 mount 
option (XFS).


Regards
Michał


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize question

2013-05-08 Thread tamouse mailing lists
On Tue, May 7, 2013 at 10:16 PM, Curtis Maurand cur...@maurand.com wrote:
 find -name *.js -exec removestring.php '{}' \;

 That's how I get the I put file name. I think that I need the if statement
 to look at the filesize and make sure that I can open them and they are at
 least the size of the string that I'm looking to cleanse.


That's  how you pass the name into the php script; how does $inputfile
get set (via $argv somehow) once you're inside php?

This line:

 $inputline = fread($inputfile, filesize($argv[1]));

Somehow, you opened $inputfile (assuming via fopen) by passing it a
file name, presumably off the command line. Show me(us) where that
happens.

 Would that joomla.modules would use the ftp layer if it were turned on. Then
 I wouldn't have to be scanning files dor malicious iframes or if clamav
 coyld remove offending code without removing the entire file...

I don't know anything about joomla.

 tamouse mailing lists tamouse.li...@gmail.com wrote:

 On Tue, May 7, 2013 at 8:16 AM, Curtis Maurand cur...@maurand.com wrote:

 Hello,
 I'm feeding a filename to a php script on the command line (command line
 program).  I run the following against it:

 $inputline = fread($inputfile, filesize($argv[1]));

 I'm getting an error complaining that the second parameter can't be '0'


 The thing to look for, is how did you get $inputfile out of the
 command line, and why you'd expect the file name to be in $argv[1] at
 that point? Marco's suggestion isn't really going to work as
 $inputfile will be a file handle, and filesize() needs the name of the
 file. Maybe want to give us a wider look at what your code is doing?

 Generically, you can wrap this
 up as:

 function binread_file($filename)
 {
 $handle = fopen($filename,'rb');
 if (FALSE === $handle) die(Unable to open $filename);
 $contents = fread($handle, filesize($filename));
 if (FALSE === $contents) die(Unable to read $filename);
 return $contents;
 }


 --
 Sent from my Android phone with K-9 Mail. Please excuse my brevity.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize question

2013-05-07 Thread ma...@behnke.biz


 Curtis Maurand cur...@maurand.com hat am 7. Mai 2013 um 15:16 geschrieben:


 Hello,
 I'm feeding a filename to a php script on the command line (command line
 program).  I run the following against it:

 $inputline = fread($inputfile, filesize($argv[1]));

mayve

$inputline = fread($inputfile, filesize($inputfile));


 I'm getting an error complaining that the second parameter can't be '0'

 any ideas?

 thanks,
 Curtis





 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize question

2013-05-07 Thread tamouse mailing lists
On Tue, May 7, 2013 at 8:16 AM, Curtis Maurand cur...@maurand.com wrote:
 Hello,
 I'm feeding a filename to a php script on the command line (command line
 program).  I run the following against it:

 $inputline = fread($inputfile, filesize($argv[1]));

 I'm getting an error complaining that the second parameter can't be '0'

The thing to look for, is how did you get $inputfile out of the
command line, and why you'd expect the file name to be in $argv[1] at
that point? Marco's suggestion isn't really going to work as
$inputfile will be a file handle, and filesize() needs the name of the
file. Maybe want to give us a wider look at what your code is doing?

Generically, you can wrap this up as:

 function binread_file($filename)
 {
   $handle = fopen($filename,'rb');
   if (FALSE === $handle) die(Unable to open $filename);
   $contents = fread($handle, filesize($filename));
   if (FALSE === $contents) die(Unable to read $filename);
   return $contents;
 }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-09 Thread Daniel Brown

On 6/8/07, Richard Lynch [EMAIL PROTECTED] wrote:



On Thu, June 7, 2007 12:04 pm, Chris Boget wrote:
Have you uncommented or added `extension=php_mime_magic.dll` in
 your php.ini file for mime_content_type()?  What about adding
 something like this, as well:

 extension=php_mime_magic.dll is commented out in my php.ini.  So that
 explains why the mime_content_type() isn't working.  That's fine.  Is
 this
 DLL also responsible for filesize()?

Do you have anything in the `disable_functions =` area of your
 php.ini?

 No, there are no disabled functions definined in my php.ini.

The fact that filesize is failing and stat is failing when you
give a specific filename suggests to me that your filename is at
fault.

Try things like:

echo file_exists($filename); // if it's there, it should be TRUE

$path = dirname($filename);
$dir = opendir($path) or die($path is not there\n);
while (($file = readdir($dir)) !== false){
  echo $file, : , filesize($path/$file), br /\n;
}

This will list all the files in the directory -- which may not be the
directory you think you are looking at, ESPECIALLY if you are using
relative directories.


 thnx,
 Chris

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




--
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?




   That wouldn't explain the fatal (exit 1) status for undefined
functions though, Rich.  Chris, you didn't compile this from source,
right?  If you're using a binary, it should work Out Of The Box [tm].
Are you using a development version or stable?  Have you noticed
problems with other functions that are expected to work?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-08 Thread Richard Lynch


On Thu, June 7, 2007 12:04 pm, Chris Boget wrote:
Have you uncommented or added `extension=php_mime_magic.dll` in
 your php.ini file for mime_content_type()?  What about adding
 something like this, as well:

 extension=php_mime_magic.dll is commented out in my php.ini.  So that
 explains why the mime_content_type() isn't working.  That's fine.  Is
 this
 DLL also responsible for filesize()?

Do you have anything in the `disable_functions =` area of your
 php.ini?

 No, there are no disabled functions definined in my php.ini.

The fact that filesize is failing and stat is failing when you
give a specific filename suggests to me that your filename is at
fault.

Try things like:

echo file_exists($filename); // if it's there, it should be TRUE

$path = dirname($filename);
$dir = opendir($path) or die($path is not there\n);
while (($file = readdir($dir)) !== false){
  echo $file, : , filesize($path/$file), br /\n;
}

This will list all the files in the directory -- which may not be the
directory you think you are looking at, ESPECIALLY if you are using
relative directories.


 thnx,
 Chris

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
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



Re: [PHP] filesize() and mime_content_type()

2007-06-07 Thread Daniel Brown

On 6/7/07, Chris Boget [EMAIL PROTECTED] wrote:

Is there anything special you need to do to utilize these functions?  The
former says it's available in versions 4 and 5 while the latter states that
it's available in versions = 4.3 and 5 (although is deprecated).  I'm
currently running PHP version 4.3.11 on a Windows NT box.  Based on both
those pieces of information, it seems like I should be able to make use of
these 2 functions.  However, whenever I run the script I wrote doing so, I
get the errors

Fatal error: Call to undefined function: mime_content_type()

and

Fatal error: Call to undefined function: filesize()

Why?  They are both internal PHP functions and are both available (or should
be available) in the version of PHP that I am running.  What's going on?

thnx,
Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




   Sounds like a problem with the installation.  However, speaking of
deprecated, the mime_content_type() function is deprecated itself.
It's replaced by the PECL extension Fileinfo.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-07 Thread Chris Boget

Sounds like a problem with the installation.
What could go wrong with an installation on a Windows machine that uses 
the binaries?  Why would it be only these functions (that I can tell) that 
would be missing?  Is there somewhere I can go and check (possibly using 
phpinfo()) to find out if these functions should be available?


basename() works, dirname() works, filetype() works...  all functions 
seemingly similar enough to, at least in my mind, filesize() such that I 
would think that if filesize() is undefined then those other functions would 
be undefined too.


thnx,
Chris 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-07 Thread Daniel Brown

On 6/7/07, Chris Boget [EMAIL PROTECTED] wrote:

 Sounds like a problem with the installation.
 What could go wrong with an installation on a Windows machine that uses
 the binaries?  Why would it be only these functions (that I can tell) that
 would be missing?  Is there somewhere I can go and check (possibly using
 phpinfo()) to find out if these functions should be available?

basename() works, dirname() works, filetype() works...  all functions
seemingly similar enough to, at least in my mind, filesize() such that I
would think that if filesize() is undefined then those other functions would
be undefined too.

thnx,
Chris




   Have you uncommented or added `extension=php_mime_magic.dll` in
your php.ini file for mime_content_type()?  What about adding
something like this, as well:

[mime_magic]
mime_magic.debug = On
mime_magic.magicfile = c:\php\extras\magic.mime

   Do you have anything in the `disable_functions =` area of your php.ini?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-07 Thread Chris Boget

Sounds like a problem with the installation.


What could go wrong with an installation on a Windows machine that uses the 
binaries?  Why would it be only these functions (that I can tell) that would 
be missing?  Is there somewhere I can go and check (possibly using 
phpinfo()) to find out if these functions should be available?


However, speaking of deprecated, the mime_content_type() function is 
deprecated itself.

It's replaced by the PECL extension Fileinfo.


Yes, I saw that in the online docs.  Unfortunately, we don't have PECL 
installed nor could I get it installed any time soon...


thnx,
Chris 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-07 Thread Daniel Brown

On 6/7/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 6/7/07, Chris Boget [EMAIL PROTECTED] wrote:
  Sounds like a problem with the installation.
  What could go wrong with an installation on a Windows machine that uses
  the binaries?  Why would it be only these functions (that I can tell) that
  would be missing?  Is there somewhere I can go and check (possibly using
  phpinfo()) to find out if these functions should be available?

 basename() works, dirname() works, filetype() works...  all functions
 seemingly similar enough to, at least in my mind, filesize() such that I
 would think that if filesize() is undefined then those other functions would
 be undefined too.

 thnx,
 Chris



Have you uncommented or added `extension=php_mime_magic.dll` in
your php.ini file for mime_content_type()?  What about adding
something like this, as well:

[mime_magic]
mime_magic.debug = On
mime_magic.magicfile = c:\php\extras\magic.mime

Do you have anything in the `disable_functions =` area of your php.ini?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



   Oh, I also forgot to ask what do you get when you use stat()?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-07 Thread Chris Boget

   Oh, I also forgot to ask what do you get when you use stat()?


stat() works, but not if I pass in the actual name of the file.  I have to 
use fstat() in order to get the proper data.  I'll have to check to see if 
there are any functions disabled in the php.ini (I don't believe there are 
any) but if fstat()/stat() work, I'm at a loss to explain why filesize() 
doesn't... :|  or, also, why stat() doesn't work when I use a correct 
filename.


thnx,
Chris 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() and mime_content_type()

2007-06-07 Thread Chris Boget

   Have you uncommented or added `extension=php_mime_magic.dll` in
your php.ini file for mime_content_type()?  What about adding
something like this, as well:


extension=php_mime_magic.dll is commented out in my php.ini.  So that 
explains why the mime_content_type() isn't working.  That's fine.  Is this 
DLL also responsible for filesize()?



   Do you have anything in the `disable_functions =` area of your php.ini?


No, there are no disabled functions definined in my php.ini.

thnx,
Chris 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() Returns a file size. What will return a directorysize()???

2005-03-29 Thread Lupita
Yes it is on a Linux system.
I have done a little research and I am having a hard time finding info about 
executing shell commands with php.
This seems like a very interesting possibility being able to use shell 
commands. Any info you could point me to would be very appreciated.
I did find this piece of code that doesn't work for me. Maybe it is missing 
something?
?php
$mstrng = shell_exec('du -sc home/joeuser/www/testdir/');
print $mstrng;
?
It produces 0 total and I know there is more then 11 kb of file in the 
directory.
I tried it pointed directly at the file in the directory and I also tried 
the du -h.
Thank you so much for your response.

Jay Blanchard [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
[snip]
I have been looking for a solution to get the disk size of a directory.
I would like to be able to get the size of a directory with sub
directories
under it.
Will I need to loop through file sizes to get the total directory size?
[/snip]

If you are on a *nix system of some sort you could exec du -h 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() Returns a file size. What will return a directorysize()???

2005-03-29 Thread Dotan Cohen
On Tue, 29 Mar 2005 08:51:49 -0800, Lupita [EMAIL PROTECTED] wrote:
 Yes it is on a Linux system.
 I have done a little research and I am having a hard time finding info about
 executing shell commands with php.
 This seems like a very interesting possibility being able to use shell
 commands. Any info you could point me to would be very appreciated.
 I did find this piece of code that doesn't work for me. Maybe it is missing
 something?
 ?php
 $mstrng = shell_exec('du -sc home/joeuser/www/testdir/');
 print $mstrng;
 ?
 It produces 0 total and I know there is more then 11 kb of file in the
 directory.
 I tried it pointed directly at the file in the directory and I also tried
 the du -h.
 Thank you so much for your response.
 
 Jay Blanchard [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 [snip]
 I have been looking for a solution to get the disk size of a directory.
 I would like to be able to get the size of a directory with sub
 directories
 under it.
 Will I need to loop through file sizes to get the total directory size?
 [/snip]
 
 If you are on a *nix system of some sort you could exec du -h
 
 --

You would be much better off looping through the files. I avoid
shellwrapping for many reasons, not the least of which is security.

Dotan Cohen

http://English-Lyrics.com/
http://Song-Lirics.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] filesize() Returns a file size. What will return a directorysize()???

2005-03-28 Thread Jay Blanchard
[snip]
I have been looking for a solution to get the disk size of a directory.
I would like to be able to get the size of a directory with sub
directories 
under it.
Will I need to loop through file sizes to get the total directory size? 
[/snip]

If you are on a *nix system of some sort you could exec du -h

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize ????

2005-03-15 Thread Rasmus Lerdorf
[EMAIL PROTECTED] wrote:
I need to calculate the size of an html email with embedded images. Filesize
doesn't work to this purpose. How could I do without parsing the html file?
If the images are embedded, by which I suppose you mean attached, then 
filesize() should be fine.  If you mean they are just img tags 
referring to external images, then they aren't part of the message and 
filesize() is still the correct size since most email client block these 
images anyway.

-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] filesize math

2004-12-24 Thread tg-php
Well, depends on your definition of a kb, mb, gb, etc..

You seem to be mixing definitions here.

One school of thought is that...

1000 bytes = 1 kb
1000 kb = 1 mb
1000 mb = 1 gb

In reality...

1024 bytes = 1 kb
1024 kb = 1 mb
1024 mb = 1 gb

You're checking filesize against the '1000' method then you're returning a 
number based on the '1024' method.

You should always be consistant across the board.

-TG

= = = Original message = = =

i made this function and want to know if i am doing the math correctly..
seems to be caculating ok.. $filesize is in bytes.. if the filesize is under
1MB i want to show KBs, if its under 1GB i want to show MB, if its over
1000MB i want to show GB, makes sense? ;)

function byte_format($filesize)

 if ($filesize  100)
 
  return number_format($filesize / 1024, 2, '.', '') . ' KB';
 
 else if($filesize  10)
 
 return number_format($filesize / 1024 / 1024 / 1024, 2, '.', '') .
' GB';
 
 else
 
return number_format($filesize / 1024 / 1024, 2, '.', '') . ' MB';


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize math

2004-12-24 Thread Greg Donald
On Fri, 24 Dec 2004 04:15:10 -0500, Sebastian
[EMAIL PROTECTED] wrote:
 i made this function and want to know if i am doing the math correctly..
 seems to be caculating ok.. $filesize is in bytes.. if the filesize is under
 1MB i want to show KBs, if its under 1GB i want to show MB, if its over
 1000MB i want to show GB, makes sense? ;)
 
 function byte_format($filesize)
 {
 if ($filesize  100)
 {
  return number_format($filesize / 1024, 2, '.', '') . ' KB';
 }
 else if($filesize  10)
 {
 return number_format($filesize / 1024 / 1024 / 1024, 2, '.', '') .
 ' GB';
 }
 else
 {
return number_format($filesize / 1024 / 1024, 2, '.', '') . ' MB';
 }
 }

Seems overly complex.  Why not something like:

$file_name = /path/to/file;
$file_type = array( 'K', 'M', 'G' );
$size = filesize ( $file_name );
for ( $t = 0; $size  1024; $t++ )
{
$size /= 1024;
$file_size = round ( $size, 1 ) . ' ' . $file_type[ $t ] . 'B';
}
echo \$file_size = $file_size;


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Filesize

2004-06-23 Thread Matt Matijevich
[snip]
Have I gone loopy? Wait, don't answer that. Do I need to do something
else to get the file size? I have read and searched, but to no avail
yet. TIA!
[/snip]

Have you tried absolute path in  filesize($theFile); or maybe chdir to
$arrDirectory[$i]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Filesize

2004-06-23 Thread Geethanandh Kandasamy
the file should be in he same folder as that of the php script,
otherwise you have to mention the absolute/relative path

Geethanandh

On Wed, 23 Jun 2004 15:06:52 -0500, Jay Blanchard
[EMAIL PROTECTED] wrote:
 
 Boy you'd think that this would be simple, but I get no filesize with
 the following
 
 for($i = 4; $i  count($arrDirectory); $i++){
if(is_dir($arrDirectory[$i])){
if($theDir = opendir($arrDirectory[$i])){
while(($theFile = readdir($theDir)) !== FALSE){
$theSize = filesize($theFile);
echo $theFile . \t . $theSize . \n;
}
}
fclose($theDir);
}
 }
 
 Heck, I even get some warnings...
 
 PHP Warning:  filesize(): Stat failed for cw.tol.1040606180942.txt.gz
 (errno=2 - No such file or directory) in
 /usr/local/www/data.default/test/dvdArchivePackager.php on line 50
 PHP Warning:  filesize(): Stat failed for cw.tol.1040607181154.txt.gz
 (errno=2 - No such file or directory) in
 /usr/local/www/data.default/test/dvdArchivePackager.php on line 50
 cw.acc.1040605182621.txt.gz
 cw.acc.1040606182502.txt.gz
 cw.acc.1040607182719.txt.gz
 cw.tol.1040519181155.txt.gz
 
 Have I gone loopy? Wait, don't answer that. Do I need to do something
 else to get the file size? I have read and searched, but to no avail
 yet. TIA!
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Filesize

2004-06-23 Thread Jay Blanchard
[snip]
the file should be in he same folder as that of the php script,
otherwise you have to mention the absolute/relative path
[/snip]

I have tried the absolute path, it doesn't waork. Crud.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Filesize

2004-06-23 Thread Marek Kilimajer
Jay Blanchard wrote --- napísal::
Boy you'd think that this would be simple, but I get no filesize with
the following
for($i = 4; $i  count($arrDirectory); $i++){
if(is_dir($arrDirectory[$i])){
if($theDir = opendir($arrDirectory[$i])){
while(($theFile = readdir($theDir)) !== FALSE){
//  $theSize = filesize($theFile);
$theSize = filesize($arrDirectory[$i] . '/' . $theFile);

			echo $theFile . \t . $theSize . \n;
			}
		}
		fclose($theDir);	
	} 
}

Heck, I even get some warnings...
PHP Warning:  filesize(): Stat failed for cw.tol.1040606180942.txt.gz
(errno=2 - No such file or directory) in
/usr/local/www/data.default/test/dvdArchivePackager.php on line 50
PHP Warning:  filesize(): Stat failed for cw.tol.1040607181154.txt.gz
(errno=2 - No such file or directory) in
/usr/local/www/data.default/test/dvdArchivePackager.php on line 50
cw.acc.1040605182621.txt.gz
cw.acc.1040606182502.txt.gz
cw.acc.1040607182719.txt.gz
cw.tol.1040519181155.txt.gz
Have I gone loopy? Wait, don't answer that. Do I need to do something
else to get the file size? I have read and searched, but to no avail
yet. TIA!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Filesize

2004-06-23 Thread Geethanandh Kandasamy
while(($theFile = readdir($theDir)) !== FALSE){

!= not !==


On Wed, 23 Jun 2004 15:06:52 -0500, Jay Blanchard
[EMAIL PROTECTED] wrote:
 
 Boy you'd think that this would be simple, but I get no filesize with
 the following
 
 for($i = 4; $i  count($arrDirectory); $i++){
if(is_dir($arrDirectory[$i])){
if($theDir = opendir($arrDirectory[$i])){
while(($theFile = readdir($theDir)) !== FALSE){
$theSize = filesize($theFile);
echo $theFile . \t . $theSize . \n;
}
}
fclose($theDir);
}
 }
 
 Heck, I even get some warnings...
 
 PHP Warning:  filesize(): Stat failed for cw.tol.1040606180942.txt.gz
 (errno=2 - No such file or directory) in
 /usr/local/www/data.default/test/dvdArchivePackager.php on line 50
 PHP Warning:  filesize(): Stat failed for cw.tol.1040607181154.txt.gz
 (errno=2 - No such file or directory) in
 /usr/local/www/data.default/test/dvdArchivePackager.php on line 50
 cw.acc.1040605182621.txt.gz
 cw.acc.1040606182502.txt.gz
 cw.acc.1040607182719.txt.gz
 cw.tol.1040519181155.txt.gz
 
 Have I gone loopy? Wait, don't answer that. Do I need to do something
 else to get the file size? I have read and searched, but to no avail
 yet. TIA!
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Filesize SOLVED

2004-06-23 Thread Jay Blanchard
[snip]
 Boy you'd think that this would be simple, but I get no filesize with
 the following
[/snip]

I HAVE gone loopy I was concating the directory HANDLE instead of
the directory PATH...problem solved, idiot slapped in/on forehead

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Filesize

2004-06-23 Thread Justin Patrin
On Wed, 23 Jun 2004 16:30:59 -0400, Geethanandh Kandasamy
[EMAIL PROTECTED] wrote:
 
 while(($theFile = readdir($theDir)) !== FALSE){
 
 != not !==
 

!== is correct, check the manual. If you had a directory named 0, !=
false would be false.

--
paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] filesize() error - Can anyone help?

2003-10-20 Thread R'twick Niceorgaw
Hi,

Jacques Roux said the following on 10/17/2003 10:55 AM

Dear All

I am getting the following error message when I open some of the page on my
Web Site.  What could the problem be and how can I correct it?
Warning: filesize() [function.filesize]: Stat failed for
./admin/dbimages/tblProjects/image/776 (errno=2 - No such file or directory)
in /data/ns-home/b2b/www.impumelelo.org.za/html/project_detail.php on line
10
Regards

Jacques

does this file (./admin/dbimages/tblProjects/image/776 ) exist?
If so, try to give the full pathname to the file in project_detail.php.
HTH
R'twick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] filesize comparison for upload

2003-07-21 Thread CPT John W. Holmes
 I have an upload form that will be used for some really large files. I
need to ask a couple of questions about the ways of improving the success
rate that I have using it.

 (1) what is the best and most stable method for uploading a large file.
Sometimes the transfer peters out.

 (2) how can I get the status of this process? I need to display a
percentage uploaded, or a ASCII progress bar, or a progress of some sort.
The current form just leaves a user wondering if his browser has crashed or
something. Will I need to trigger a repeat loop in a pop-up that checks
filesize and displays it?

Use FTP. You don't get any features with HTML upload.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] FileSize and file_exist failing a file that I am sure is there

2002-11-12 Thread Ernest E Vogelsinger
At 17:27 12.11.2002, Brandon Orther spoke out and said:
[snip]
When try to get a file_exist response I get the following error:
 
Warning:  stat failed for /home/admin/2002-11-12-Part1.mp3
 (errno=2 - No such file or directory) in
b/home/admin/hsReleaser.php/b on line b20/bbr
 
But I am rather sure that the file does exist.  If I open
/home/admin/2002-11-12-Part1.mp3 it does exist.
[snip] 

Maybe the open_basedir limitation is in effect, and /home/admin is outside
the allowed base directory?


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



RE: [PHP] FileSize and file_exist failing a file that I am sure is there

2002-11-12 Thread Brandon Orther
Hello,
 
Open_basedir is not set in the php.ini  and I can rename the files
without an issue using the rename function.
 
 
Brandon Orther 
WebIntellects Design/Development Manager
[EMAIL PROTECTED] 800-994-6364
www.webintellects.com http://www.webintellects.com/ 

-Original Message-
From: Ernest E Vogelsinger [mailto:ernest;vogelsinger.at] 
Sent: Tuesday, November 12, 2002 9:42 AM
To: Brandon Orther
Cc: PHP User Group
Subject: Re: [PHP] FileSize and file_exist failing a file that I am sure
is there
 
At 17:27 12.11.2002, Brandon Orther spoke out and said:
[snip]
When try to get a file_exist response I get the following error:
 
Warning:  stat failed for /home/admin/2002-11-12-Part1.mp3
 (errno=2 - No such file or directory) in
b/home/admin/hsReleaser.php/b on line b20/bbr
 
But I am rather sure that the file does exist.  If I open
/home/admin/2002-11-12-Part1.mp3 it does exist.
[snip] 

Maybe the open_basedir limitation is in effect, and /home/admin is
outside the allowed base directory?



-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] FileSize -- fread($fd, 7000)

2001-08-16 Thread Mukul Sabharwal

Hi,

fread($fd, filesize(somefile.txt));

--- Augusto Cesar Castoldi
[EMAIL PROTECTED] wrote:
 Hi.
 
 instead use 7000 in fread($fd, 7000), i'd like
 to use the size of the
 file opened. How can I know the size of the fopen?
 
 thanks.
 
 Augusto
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 


=
*
http://www.geocities.com/mimodit
*

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] FileSize -- fread($fd, 7000)

2001-08-16 Thread Mukul Sabharwal

Hi,

It doesnt' matter what you're doing, filesize will
give you what it reads from the particular file.

--- Augusto Cesar Castoldi
[EMAIL PROTECTED] wrote:
 ops.
 
 I forgot to say.
 
 but I'm calling a script, so I get diferents
 filesizes
 
 $fd = fopen(http://localhost/script.php;, r);
 $aux = fread($fd, 70);
 fclose($fd);
 
 Can I now the size of $fd? Well, I need to ready
 all $fd.
 thanks.
 
 Augusto
 - Original Message -
 From: Mukul Sabharwal [EMAIL PROTECTED]
 To: Augusto Cesar Castoldi
 [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Thursday, August 16, 2001 9:08 AM
 Subject: Re: [PHP] FileSize -- fread($fd, 7000)
 
 
  Hi,
 
  fread($fd, filesize(somefile.txt));
 
  --- Augusto Cesar Castoldi
  [EMAIL PROTECTED] wrote:
   Hi.
  
   instead use 7000 in fread($fd, 7000), i'd
 like
   to use the size of the
   file opened. How can I know the size of the
 fopen?
  
   thanks.
  
   Augusto
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail:
   [EMAIL PROTECTED]
   For additional commands, e-mail:
   [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
   [EMAIL PROTECTED]
  
 
 
  =
  *
  http://www.geocities.com/mimodit
  *
 
  __
  Do You Yahoo!?
  Make international calls for as low as $.04/minute
 with Yahoo! Messenger
  http://phonecard.yahoo.com/
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 
 
 
 


=
*
http://www.geocities.com/mimodit
*

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]