Jump to content

Archived

This topic is now archived and is closed to further replies.

ShootingBlanks

filesize() [function.filesize]: stat failed...but it works???

Recommended Posts

Hello.  I'm getting the following error:

 

Warning: filesize() [function.filesize]: stat failed for C:\WINDOWS\Temp\php1F7.tmp in D:\Inetpub\wwwroot\ManagersToolbox.anixter.com\Fastenermanagers\Toolbox\admin\uploadDocument.php on line 84

 

However, everything appears to be functioning in my application (despite that error).  Googling, it looked that that error appears when a directory is not writeable.  But the files are uploading fine, so I'm not sure why this error is happening.  Any ideas???

 

 

Share this post


Link to post
Share on other sites

It's a Warning not an Error.

 

Have you tried different files and sizes?  It may be specific for "php1f7".

Share this post


Link to post
Share on other sites
Have you tried different files and sizes?  It may be specific for "php1f7".

 

Yeah - I've tried different doc types and different sizes.  What's "php1f7" mean???  Thanks!

 

Share this post


Link to post
Share on other sites

It's likely that the file is inaccessible due to safe mode restrictions that apply to filesize(), but that the normal commands used to access the upload (I'll assume this an upload) file do have permissions.

 

If error_reporting was set to E_ALL, you would probably also be getting notice errors that would tell you why the filesize() statement is failing.

Share this post


Link to post
Share on other sites
If error_reporting was set to E_ALL, you would probably also be getting notice errors that would tell you why the filesize() statement is failing.

 

Is that something that I'd change in the .ini file?  (i ask because i'd have to get our company's IT department to do that)

 

This is odd.  I mean, everything on the application appears to be working fine.  I can upload files and then retrieve them with no problems (that's the general basis of the application).  I can't figure out what the warning/error would be indicating!...

Share this post


Link to post
Share on other sites

You can put the following two lines in your script for debugging purposes -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

What does a phpinfo(); statement show for safe mode?

Share this post


Link to post
Share on other sites

You can put the following two lines in your script for debugging purposes -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

I still get the same error as before after doing that:

Warning: filesize() [function.filesize]: stat failed for C:\WINDOWS\Temp\php1FA.tmp in D:\Inetpub\wwwroot\ManagersToolbox.anixter.com\Fastenermanagers\Toolbox\admin\uploadDocument.php on line 87

 

What does a phpinfo(); statement show for safe mode?

 

It says it's "off" for both the local and master value.  What does that indicate?  Thanks again for the quick help!!!

 

Share this post


Link to post
Share on other sites

Can you post the code you are using this in? Maybe that will give us some hint on how to fix this issue for you.

Share this post


Link to post
Share on other sites

Can you post the code you are using this in? Maybe that will give us some hint on how to fix this issue for you.

 

There's a lot of code on the page, but this is the line that the error refers to:

 

// Now check the filesize, if it is too large then DIE and inform the user.
if(filesize($ftempname) > $max_filesize) {
$error[] = 'The file you attempted to upload is too large.<br />';
}

 

Then there's this part earlier on (which explains $max_filesize):

 

// *** Configuration - Your Options ***
$allowed_filetypes = array('.xls','.pdf','.doc','.ppt'); // Allowable file types
$max_filesize = 2097152; // Maximum filesize in BYTES (currently 2MB)
$upload_path = '../uploads/'.$folder.'/'; // Upload directory

 

And $ftempname is set here (even earlier still):

 

// *** set variables for $_FILES superglobal array ***
$fname = stripslashes($_FILES['userfile']['name']);
$ftype = $_FILES['userfile']['type'];
$fsize = $_FILES['userfile']['size'];
$ftempname = $_FILES['userfile']['tmp_name'];
$ferror = $_FILES['userfile']['error'];

 

Let me know if you need more info that that.  Thanks!...

 

 

Share this post


Link to post
Share on other sites

I am confused then, why not just use fsize to test the file size?

 

I think the issue would be within the temp folder, but not 100% sure.  You could, as an alternative base, do the move command on the file, then check the size, if the size is bad unlink that file.

 

But yea, why not just use the fsize?

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.