Solved

PHP Warning:  filesize() .. stat failed for C:\output\1024364.jpg  Why does this happen on windows 2008 IIS server + php 5?

Posted on 2011-09-21
3
579 Views
Last Modified: 2012-05-12
Why does this happen on windows 2008 IIS server + php 5?

This is the exact error I get;
[21-Sep-2011 11:32:01] PHP Warning:  filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for C:\output\1024364.jpg

Before I move the file from the tmp directory, I check its filesize there succesfully, so the function is working.

And I can read the jpg and delete it in the same script, so permissions should be enough to stat it.

Its really confusing me! Thank you

--

1) What my script does is, it checks the filesize in the tmp directory and save it in $filesize
2) Then I move the file to c:\output directory
3) Compare filesize() with $filesize
4) read the jpg and delete it afterwards.

Everything works except step 3.
0
Comment
Question by:Octalys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Expert Comment

by:Kalpan
ID: 36572682
don't move the file...use the copy command and once done unlink the temp directory...

i suppose it may not be finding the image to execute the filesize function...or may its the temp file which doesn't actually moving the file format
0
 

Accepted Solution

by:
Octalys earned 0 total points
ID: 36572719
Well technically, I have to move it.

There's another external program outside php that does something with the image, but doesnt change the filesize.

But it doesnt solve my problem either way; the file is there 100%. I read and delete the file in the same script, so why cant I filesize it. That is my problem.
0
 

Author Closing Comment

by:Octalys
ID: 36597828
Somehow after the file has been moved in the c:\output directory, it is still not available for filesize().

I found out by adding a is_readable() while loop before doing filesize()
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question