ShootingBlanks Posted January 29, 2009 Share Posted January 29, 2009 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??? Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/ Share on other sites More sharing options...
Maq Posted January 29, 2009 Share Posted January 29, 2009 It's a Warning not an Error. Have you tried different files and sizes? It may be specific for "php1f7". Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750044 Share on other sites More sharing options...
ShootingBlanks Posted January 29, 2009 Author Share Posted January 29, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750060 Share on other sites More sharing options...
DarkSuperHero Posted January 29, 2009 Share Posted January 29, 2009 i think php1F7 is the temporary file name of the uploaded file.....correct me if im mistaken... Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750070 Share on other sites More sharing options...
PFMaBiSmAd Posted January 29, 2009 Share Posted January 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750074 Share on other sites More sharing options...
ShootingBlanks Posted January 29, 2009 Author Share Posted January 29, 2009 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!... Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750082 Share on other sites More sharing options...
PFMaBiSmAd Posted January 29, 2009 Share Posted January 29, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750092 Share on other sites More sharing options...
ShootingBlanks Posted January 29, 2009 Author Share Posted January 29, 2009 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!!! Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750103 Share on other sites More sharing options...
premiso Posted January 29, 2009 Share Posted January 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750105 Share on other sites More sharing options...
ShootingBlanks Posted January 29, 2009 Author Share Posted January 29, 2009 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!... Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750121 Share on other sites More sharing options...
premiso Posted January 29, 2009 Share Posted January 29, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/143035-filesize-functionfilesize-stat-failedbut-it-works/#findComment-750128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.