Jump to content

php upload with progress bar


urban

Recommended Posts

I would tend to use Flash for this, as it is a nice way to go.

 

If you would like to not use flash, AJAX would be another alternative.

 

Ajax Upload with Progress Bar

 

As far as anything being simple, there will not be. You will have to implement etc and it will require some modifications/work.

<?php 
// Where the file is going to be placed 
$target_path = "/URLfor-the-file-to-be-uploaded-to";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); ?>

<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']?>" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>

 

This is a simple upload form, I'm not sure if it works, I aint tested it, but it looks promising. To create a progress bar, it could be done with Flash as stated in previous replies, alternatively, you would use PHP and AJAX. Check the links given for the progress bars.

Its the progress bar bit i cant do

Unfortunatly you will probably have to scrap what you have done already and download a complete uploader script. Adding a progress bar isn't straigt-forward. You will see the complexity after downloading one.

  • 1 month later...

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.