Jump to content

Archived

This topic is now archived and is closed to further replies.

rshadarack

Uploading files with progress bar

Recommended Posts

Hi, I'm fairly new to php, but a fairly experience programmer. Finally found some time to get around to learning it and now I'm a bit mad I didn't start earlier. So far it's been a breeze.

As the title indicates, I'm trying to get a progress bar to show files while downloading. I'm using the code at:

[a href=\"http://www.devpro.it/upload_progress/\" target=\"_blank\"]http://www.devpro.it/upload_progress/[/a]

But I can't seem to get it to work. I pretty much copy and pasted all the files from the site, the only one which wasn't on there was the file that handled the actual moving of the file, index.php:

[code]
<?php
$uploaddir = '../upload/';
$uploadfile = $uploaddir . basename($_FILES['gfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['gfile']['tmp_name'], $uploadfile)) {
   echo "File is valid, and was successfully uploaded.\n";
} else {
   echo "Error!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

echo "</pre>";

?>
[/code]

However, I am still running into problems. First of all (and I've had this problem with other uploading scripts), firefox displays "The script has stopped responding" when ever uploading larger files (seems to be around +300k). But this is really more an annoyance than a problem since after I stop the script, it goes to the page saying that the file upload was successful, and indeed, it does work. But also there is nothing that pops up to display the progress.

The files I have in my directory are:

BytesUploaded.js
index.php
LoadVars.js
test.php //this is the main file, I don't think the name of it matters, right?
UploadProgressManager.class.php
whileuploading.php

Any help would be much appreciated!

Share this post


Link to post
Share on other sites
Did you increase max execution time in the PHP.INI file?

Share this post


Link to post
Share on other sites
Ah, ok, so that explains the problem with the script not responding.

But I still can't seem to get the progress bar to pop up.

Share this post


Link to post
Share on other sites

×

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.