xagutxu Posted June 6, 2011 Share Posted June 6, 2011 Hi: I have found that something strange happens in my php script. I wish someone could explain me why. I receive an image via POST, and it is saved as a temporary file in the server: $tmpName = $_FILES['uploadedfile']['tmp_name']; The filesize I obtain doing: $fileSize = $_FILES['uploadedfile']['size']; is 79733, the same as if I did: filesize($tmpName). Ok. Now, I resize the image, and save it in the same $tmpName, and everything is ok, but when I try to obtain the size, I get the first size, that is: 79733. Anybody has an explanation? Thank you in advance, Xagutxu Quote Link to comment https://forums.phpfreaks.com/topic/238591-obtaining-size-of-rewritten-image-file/ Share on other sites More sharing options...
dougjohnson Posted June 6, 2011 Share Posted June 6, 2011 You may need to save the file to some other location other than the temp location and then calculate the file size??? For security reasons you probably want this location to be outside the root of your server. Quote Link to comment https://forums.phpfreaks.com/topic/238591-obtaining-size-of-rewritten-image-file/#findComment-1226096 Share on other sites More sharing options...
requinix Posted June 6, 2011 Share Posted June 6, 2011 PHP caches that kind of file and directory information. You can clear the cache with clearstatcache. Quote Link to comment https://forums.phpfreaks.com/topic/238591-obtaining-size-of-rewritten-image-file/#findComment-1226098 Share on other sites More sharing options...
xagutxu Posted June 6, 2011 Author Share Posted June 6, 2011 It works! Thank you, requinix! Xagutxu Quote Link to comment https://forums.phpfreaks.com/topic/238591-obtaining-size-of-rewritten-image-file/#findComment-1226103 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.