Jump to content

PHP Progress bar


eli312

Recommended Posts

Hey all,

 

Not sure if this is in the correct place (sorry if it is not)

 

But i have been looking for hours now for a simple progress bar system when uploading bigger files.

Im not even looking for good looking loading bar a simple percent would be good for me.

 

But every site i have looked at to get any help or ideas from the comments are "Does not work", "Error" and that sort of thing.

I have even tried many myself and can not get them to work. (at least 5-6)

 

Some even requires the you to install add on programs to your sever - this i can not do as i don't own it.

 

There must be a easy way to solve this problem?

 

Please help

 

Thank you.

 

Eli

 

 

Link to comment
Share on other sites

The problem occurs because it is the web server that handles the upload and only invokes the target page of the form action = "" attribute once the upload has completed.

 

Even the Alternative PHP Cache (APC) upload progress is limited to a single thread because they did not build in a way of passing a unique process id back and forth between the pieces of code.

 

I have seen a php script that listens on a specifically assigned port number and handles the uploading of the file directly and passes a process id to the code running in the browser. If I find the script, I will post a link.

 

Edit: http://sourceforge.net/projects/upu

Link to comment
Share on other sites

I will have to try these out when i get home.

But is there not a function to like getbytes sent?

so you could compare the file size with how much has been sent to create a simple persentage.

 

Then use AJAX to update it.

 

 

Link to comment
Share on other sites

Thanks guys for the help.

In the end i decided to go a different way (as making a progress bar was complex)

 

I simple used a little javascript/jquery not to do anything more fancy then hide the uploading functions and replace with loading please wait and an animated gif.

 

<form action="upload.php" name="upload_music" enctype="multipart/form-data" method="POST" onsubmit="checkUpload();">

 

Using the onsubmit to call checkUpload function

function checkUpload() {
$("#Music").fadeOut();
$("#upload").fadeOut();
$("#upload_box").fadeOut();
$("#upload_boxAlert").fadeIn();
}

 

Which as i said hides the uploading and replaces it with:

<div id="upload_boxAlert">File uploading please wait...<br/><br/><img src="<?php echo IMG_LINK; ?>/mucLoader.gif"><br/><h2>(this could take up to 30 minutes)</h2></div>

 

I probably end up making a a real javascript progress bar.

 

But thanks for the ideas and help guys!

 

Eli

 

 

 

Link to comment
Share on other sites

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.