jaymc Posted June 19, 2008 Share Posted June 19, 2008 I believe in php 5.2 there is a new parametre to return the temp file location of a file upload, for example /tmp/4gvb4t5gFdfs This gives the ability to probe that file at intervales to check file size, which in turn tells us how much has uploaded... I want to create a live upload status/loading bar, for example, 57% complete For that, I need to know the TOTAL file size so I can do TOTAL_SIZE - UPLOADED_SO_FAR = mb remaining I know javascript cant do this without installing active x etc, is there a way in PHP to read the initial headers or something to get the file size? Quote Link to comment https://forums.phpfreaks.com/topic/110933-solved-check-file-size/ Share on other sites More sharing options...
ober Posted June 19, 2008 Share Posted June 19, 2008 PHP will not return until the file has been completely uploaded. Do get a status bar, you'll need to use some AJAX or some other way to query the status. Quote Link to comment https://forums.phpfreaks.com/topic/110933-solved-check-file-size/#findComment-569094 Share on other sites More sharing options...
PFMaBiSmAd Posted June 19, 2008 Share Posted June 19, 2008 The Alternate Php Cache (APC) has some methods for getting information about an uploading file. That, combined with Ajax can be used to display actual upload progress (I don't know if it gives you the overall file size.) Here is a tutorial - http://www.ibm.com/developerworks/library/os-php-v525/index.html Quote Link to comment https://forums.phpfreaks.com/topic/110933-solved-check-file-size/#findComment-569103 Share on other sites More sharing options...
jaymc Posted June 19, 2008 Author Share Posted June 19, 2008 How is it possible to give a % of uploaded/remaining I can tell the user how much they have uploaded.. but someone who is not computer lit wont know if uploaded so far = 4.7mb means they are roughly 5% through uploading a 100mb file.. I need some way to let them know the status of upload, not how much they have uploaded Quote Link to comment https://forums.phpfreaks.com/topic/110933-solved-check-file-size/#findComment-569112 Share on other sites More sharing options...
PFMaBiSmAd Posted June 19, 2008 Share Posted June 19, 2008 Checkout the tutorial code at the link I posted (once you find where the link to the code is on that page). It displays percent (current/total * 100) APC is a PECL extension and it requires installation on the server if it is not already present. Quote Link to comment https://forums.phpfreaks.com/topic/110933-solved-check-file-size/#findComment-569118 Share on other sites More sharing options...
jaymc Posted June 19, 2008 Author Share Posted June 19, 2008 Ah yeh, just read that, looks like it should work although the DEMO did not work Will look into that Cheers Quote Link to comment https://forums.phpfreaks.com/topic/110933-solved-check-file-size/#findComment-569119 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.