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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

791 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