Jump to content

Uploading files with progress bar


rshadarack

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!
Link to comment
https://forums.phpfreaks.com/topic/4999-uploading-files-with-progress-bar/
Share on other sites

Archived

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

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