Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/110933-solved-check-file-size/
Share on other sites

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

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.