0

Possible Duplicate:
Upload Progress Bar in PHP

guys, i need some help with this problem

I'm doing a file upload process where the source file is transfered to the server and then the data from it is inserted in to database.

i need to display progress bar which shows the progress from the time of file uploading to server till data inserted into the database from that uploaded file.

i find files uploading progress bar only for files uploading to server and progress bar not till data insertion.

thanks in advance !

2
  • Since Apache does not pass the request to the PHP interpreter until the entire request is received, how would PHP code know anything about the status of the upload? Commented Feb 5, 2011 at 17:20
  • Possible duplicate: stackoverflow.com/questions/849237 Commented Feb 5, 2011 at 17:21

4 Answers 4

1

Okay, so to write a progress bar you need to know what 100% of the file-size are. To know the file-size on server-side (with PHP which runs server-side), you first have to receive the whole file. But after receiving the file, it doesn't help you anymore, because then the upload would be finished.

Progress-Bars on file-uploads are often done with Flash, as you can detect the file-size client-side with ActionScript (Flash's scripting language).

Sign up to request clarification or add additional context in comments.

Comments

1

You can't do that with PHP. PHP is server side language. Better way to do that is to use a jquery and animate it.

Comments

1

There is no way to do this with PHP. I'd use Uploadify.

Comments

0

To measure the progress of the SQL queryes, you can do the following:

  • After uploading the file you can run some regexp on it to detrmine how many queries you'll have to run
  • You can then register a counter in SESSION or similar where you know how many queries you have run
  • Have an AJAX script call a PHP script that gives you the total number of queries and how many of them were executed.

There are some problems though. I don't know what kind of data format you have for the file, so I presumed that it's something that can be transformed in queries. Also, it might be faster run a single query instead of hundreads (for INSERT for example)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.