473,486 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

warning - filesize():stat failed for (some file)

1 New Member
Hi,

I am coding to get the size of the file stored in a directory. But unfortunately I am bashed with the error filesize(): stat failed for fq.txt and the program is not giving the answer. I am newbee to php, it would be great if anyone could suggest anything.. my code is as follows:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $dir = "C:\Users\Desktop\php";
  4.  
  5. $dh = opendir($dir);
  6.  
  7. while (($file = readdir($dh)) == TRUE)
  8. {
  9.  
  10.     echo "Name of the file is ";
  11.  
  12.     echo $name = pathinfo($file,PATHINFO_FILENAME), "<br/>";
  13.  
  14.     echo "File Type: ";
  15.  
  16.     echo $type = pathinfo($file,PATHINFO_EXTENSION),  "<br/>";
  17.  
  18.     echo "File Size: ".filesize($file)."bytes", "<br/>", "<br/>";
  19.  
  20.     echo "path to this file is ";
  21.  
  22.     echo realpath($dir), "<br/>", "<br/>";
  23. }
  24.  
  25. closedir($dh);
  26.  
  27. ?>
Oct 24 '12 #1
0 3508

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2910
by: RickL | last post by:
I have an ASP application that uploads a specified file to the server. To retrieve the file, I simply assign the filepath and file to a hyperlink on the page. When you click "Save Target As" for...
1
1735
by: RickL | last post by:
I have an ASP application that uploads a specified file to the server. To retrieve the file, I simply assign the filepath and file to a hyperlink on the page. When you click "Save Target As" for...
7
12216
by: John R. | last post by:
How do you set the following file attributes: Compressed Encrypted Normal ReparsePoint SparsePoint You CAN'T set these using FileInfo.Attributes or File.SetAttributes. It doesn't work for...
0
2723
by: Vijay | last post by:
Hi, I have created an ActiveX ocx control in VC++6.0. When I run it in an ActiveX container of TSTCON32.exe. (the one that is shown while debugging) it runs perfectly. Iam trying to include it...
2
1676
by: Dave | last post by:
Hello. I'm developing some application which needs to upload some file to server and put it into database BLOB field. Also I want to provide this feature without saving the upload file to the...
1
2045
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
4
6697
by: csharpdevp | last post by:
I tried building a c++ project in VS 2005, and about 300 warnings, all of the following nature: warning C4503: 'std::_Tree<_Traits>::_Min' : decorated name length exceeded, name was truncated ...
6
17418
by: bluesky9394 | last post by:
I encounter the following error. Warning: getimagesize(WebRoot/common/images/profile/) : failed to open stream: Permission denied in C:\Data\PHPSites\kamwo\indextmp-new.php on line 296 but it's...
0
1335
by: SP | last post by:
Dear all! I have written a web service which should archive files in a server directory. The files are placed in a directory that the web server can access. In the first step I copy them to a...
1
2574
by: MarkyMarc | last post by:
Hi All, A small newbie Q. I have made a nice log function in me program. The program writes some data to me mysql database. When I write to the database I get som warnings back. Have do I...
0
6964
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
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
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...
0
5430
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,...
1
4864
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...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3069
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
262
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...

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.