PHP Simplicity Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Guest posting is allowed. Again!

Author Topic: Progress Bar  (Read 6611 times)

0 Members and 1 Guest are viewing this topic.

Paul York

  • Guest
Progress Bar
« on: April 20, 2010, 02:19:11 PM »

Is there any way to show a progress bar during uploads. Would be real helpful
Logged

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #1 on: May 14, 2010, 01:20:20 PM »

Not possible without hacking PHP engine itself.
Logged

We don't need a reason to help people

kwone67

  • Newbie
  • *
  • Offline Offline
  • Posts: 5
    • View Profile
Re: Progress Bar
« Reply #2 on: June 12, 2010, 02:45:40 AM »

Hi Saleh,

First, I just wanted to say thanks for the excellent script and offering your help! Your good work is appreciated and I just wanted to say Thank You:)

Second, rather than hacking the php engine could a simple animated gif image work?  I mean after a person selects the "upload" button a simple animated gift is displayed (that has nothing to do with real time file upload status) and stops or redirects to show the uploaded file when the upload is complete?

People send me 1-2GB files and they think that when they see a static looking page for an hour while there file uploads  that something must be wrong and tend to refresh or navigate away!

Thanks again

Kevin



 

Logged

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #3 on: June 24, 2010, 09:46:03 AM »

That would be fairly easy :)
Find in functions.php:
Code: [Select]
   <tr>
      <td align="center">
      <span style="font-size: 7pt; font-family: tahoma, verdana;">'.$txt['powered'].': <a href="http://www.phpsimplicity.com" target="_blank">&copy; '.NAME.'</a></span><br />
        <input type="submit" value="  '.$txt['submit'].'  " name="SFUsubmit" '.$disabled.'/></td>
   </tr>

Replace with:
Code: [Select]
   <tr>
      <td align="center">
      <span style="font-size: 7pt; font-family: tahoma, verdana;">'.$txt['powered'].': <a href="http://www.phpsimplicity.com" target="_blank">&copy; '.NAME.'</a></span><br />
        <div id="progressBar" style="display: none;"><img src="PATH/TO/PROGRESS_BAR.gif" /><br />Please wait ...<br /></div>
        <input type="submit" value="  '.$txt['submit'].'  " name="SFUsubmit" onclick=\'javascript:document.getElementById("progressBar").style.display="block"\' '.$disabled.'/></td>
   </tr>

This should work. Simply change "PATH/TO/PROGRESS_BAR.gif" to the actual progress bar image and once the submit button is clicked, it will be displayed.

Try it, and let me know.
Logged

We don't need a reason to help people

kwone67

  • Newbie
  • *
  • Offline Offline
  • Posts: 5
    • View Profile
Re: Progress Bar
« Reply #4 on: June 24, 2010, 01:43:05 PM »

Well it looks like it want's to work but it does not.  I have attached a screen shot to show you what I am looking at, it seems that it can't display the image correctly and just shows a place holder.  I also tried this with a jpg, gif and png but same result, I also checked the path to the image and it is correct.

Kevin
Logged

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #5 on: June 29, 2010, 12:46:29 PM »

Could you post the code?
Because that is definitely a problem with the image not the code. my code simply shows/hide the area so it's not Javascript's fault.
Logged

We don't need a reason to help people

kwone67

  • Newbie
  • *
  • Offline Offline
  • Posts: 5
    • View Profile
Re: Progress Bar
« Reply #6 on: June 29, 2010, 01:28:34 PM »

Okay this is what I have.

Kevin

Code: [Select]
  </tr>
   <tr>
      <td align="center">
      <span style="font-size: 7pt; font-family: tahoma, verdana;">'.$txt['powered'].': <a href="http://www.phpsimplicity.com" target="_blank">&copy; '.NAME.'</a></span><br />
        <div id="progressBar" style="display: none;"><img src="/usr/local/4admin/apache/vhosts/metrotechglobal.com/addon/lowcost-exhibits.com/progressBar.gif" /><br />Please wait ...<br /></div>
        <input type="submit" value="  '.$txt['submit'].'  " name="SFUsubmit" onclick=\'javascript:document.getElementById("progressBar").style.display="block"\' '.$disabled.'/></td>
   </tr>
    </form>
</table>';

   echo $form;
Logged

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #7 on: June 30, 2010, 02:59:00 PM »

I see. Image src should be relative to the base directory of the http server..
meaning, if your website URL is metrotechglobal.com and you stored the image in addon/images you simply put "addon/images/progressBar.gif" in src:
<img src="addon/lowcost-exhibits.com/progressBar.gif" />
Logged

We don't need a reason to help people

kwone67

  • Newbie
  • *
  • Offline Offline
  • Posts: 5
    • View Profile
Re: Progress Bar
« Reply #8 on: July 06, 2010, 09:37:29 PM »

Okay I must be doing something wrong because I still can't get it to work.  I am not sure if it matters but I should mention that I want to use this script on my website that is an "addon domain" to the main hosting account website , www.metrotechglobal.com

According to my hosting company

"Addon Hosted - Hosted mode allows an Addon domain to be hosted as a full website with its own directory and file structure. Search engines see Hosted domains as having unique content, and therefore rank them as well as they would a fully hosted site. Once set up, files for Hosted Addon domains are uploaded to the addon/addondomain.com directory via FTP"

So the path to the "fully hosted" domain that I want to use the  script is addon/lowcost-exhibits.com

and I have tried the following paths to the progressBar.gif:

img src="addon/images/progressBar.gif"
img src="lowcost-exhibits.com/images/progressBar.gif"
img src="addon/lowcost-exhibits.com/images/progressBar.gif"

I even made a directory "images" for the main website httpdoc folder and tried this path as well:

img src="/images/progressBar.gif"
img src="metrotechglobal.com/images/progressBar.gif"


So I have both file structures in place on the server with the same progressBar.gif

metrotechglobal.com/addon/lowcost-exhibits.com/images/progressBar.gif"
metrotechglobal.com/images/progressBar.gif

Clearly I have no idea what I'm doing ??? your help is appreciated

Kevin




 
Logged

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #9 on: July 15, 2010, 09:28:27 AM »

Code: [Select]
  </tr>
   <tr>
      <td align="center">
      <span style="font-size: 7pt; font-family: tahoma, verdana;">'.$txt['powered'].': <a href="http://www.phpsimplicity.com" target="_blank">&copy; '.NAME.'</a></span><br />
        <div id="progressBar" style="display: none;"><img src="../images/progressBar.gif" /><br />Please wait ...<br /></div>
        <input type="submit" value="  '.$txt['submit'].'  " name="SFUsubmit" onclick=\'javascript:document.getElementById("progressBar").style.display="block"\' '.$disabled.'/></td>
   </tr>
    </form>
</table>';

   echo $form;

This should solve everything :)
The problem was because you were not taking into account the relative paths of your structure.
Your upload script was in http://www.lowcost-exhibits.com/upload/upload.php
and you image was in http://www.lowcost-exhibits.com/images/progressBar.gif

You simply had to go up in the structure and then back to images folder.
Logged

We don't need a reason to help people

kwone67

  • Newbie
  • *
  • Offline Offline
  • Posts: 5
    • View Profile
Re: Progress Bar
« Reply #10 on: July 15, 2010, 07:41:32 PM »

It works!  Thanks for all your help.  Now that everything is working I wanted to pay you a small license fee for your script because I would like to change the following, if it's ok with you.


1. I wanted to put my logo at the top of the page with a welcome message.

2. remove the link above the "upload" button and the "Powered by Simplicity of upload"

I still want to keep the "Powered by Simplicity of upload" at the very bottom of the page but right now it says it in 2 places ( you can see what I am talking about http://www.lowcost-exhibits.com/upload/upload.php

Let me know what you think, I won't do anything unless your cool with it

Thanks

Kevin

Logged

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #11 on: July 18, 2010, 02:22:27 PM »

:)

It's fine. You could put a logo and remove one of the powered by phrases but just make sure the remaining one has a link to my website. You can change it's place to anywhere you want.
Logged

We don't need a reason to help people

michel111

  • Newbie
  • *
  • Offline Offline
  • Posts: 1
    • View Profile
Re: Progress Bar
« Reply #12 on: October 23, 2010, 06:06:44 AM »

I know there are lots of scripts out there for a PHP progress bar, most implementing CGI but I have not had any success with them. Does anyone know of a surefire way to implement a progress bar for PHP that works with a simple html form?

darrell18ho

  • Newbie
  • *
  • Offline Offline
  • Posts: 1
    • View Profile
Re: Progress Bar
« Reply #13 on: November 23, 2010, 06:04:57 AM »

Can you [please tell the way how we show the progress bar while the process is going to complete.I want the step by step description it will help me.Thanks in advance..
Logged

Hawk

  • Newbie
  • *
  • Offline Offline
  • Posts: 9
    • View Profile
Re: Progress Bar
« Reply #14 on: November 23, 2010, 03:40:54 PM »

If you read this whole thread, it tells you how.

Open functions.php and Find:
Code: [Select]
<tr>
      <td align="center">
      <span style="font-size: 7pt; font-family: tahoma, verdana;">'.$txt['powered'].': <a href="http://www.phpsimplicity.com" target="_blank">&copy; '.NAME.'</a></span><br />
        <input type="submit" value="  '.$txt['submit'].'  " name="SFUsubmit" '.$disabled.'/></td>
   </tr>

Replace with this:
Code: [Select]
<tr>
      <td align="center">
      <span style="font-size: 7pt; font-family: tahoma, verdana;">'.$txt['powered'].': <a href="http://www.phpsimplicity.com" target="_blank">&copy; '.NAME.'</a></span><br />
        <div id="progressBar" style="display: none;"><img src="../images/progressBar.gif" /><br />Please wait ...<br /></div>
        <input type="submit" value="  '.$txt['submit'].'  " name="SFUsubmit" onclick='javascript:document.getElementById("progressBar").style.display="block"' '.$disabled.'/></td>
   </tr>

Just change <img src="path to your image/image name" /> to reflect where your image is and the name of your image.

It's not really a progress bar, but you use an animated image to act as one, and it will only display while the file is being uploaded.

You can go to this link and see how it works.  http://paphalophagus.com/test/upload-page.htm
« Last Edit: November 23, 2010, 04:14:40 PM by Hawk »
Logged
Hawk

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #15 on: November 24, 2010, 11:35:05 AM »

Hawk, thank you but don't bother. It's a bot. They are invading my forum again. Maybe I should add more defensive measures against spam bots.
Logged

We don't need a reason to help people

Hawk

  • Newbie
  • *
  • Offline Offline
  • Posts: 9
    • View Profile
Re: Progress Bar
« Reply #16 on: November 24, 2010, 11:40:26 AM »

I sort of thought so, but wasn't sure.
Thought I'd try to help out anyway, just in case.  ;D

I saw that you tried to upload a jpg. I figured for this test page I'd limit allowed file types to just the packages, zip, rar, and 7z.  ;)

I've got the real script running on 2 different sites of mine and so far it seems to be working fine, although one member couldn't add his forum username because there is a space in it. I got it fixed though. I forget to add the \ in front of the s.  ::)
Logged
Hawk

Saleh

  • Administrator
  • Full Member
  • *****
  • Offline Offline
  • Posts: 222
    • View Profile
    • PHP Simplicity
Re: Progress Bar
« Reply #17 on: December 02, 2010, 06:08:24 PM »

Eh! Did I add my name when I upload that file?! can't remember :P
I am glad to hear that you are making use of the script :)
Logged

We don't need a reason to help people

Hawk

  • Newbie
  • *
  • Offline Offline
  • Posts: 9
    • View Profile
Re: Progress Bar
« Reply #18 on: December 02, 2010, 08:02:51 PM »

No you didn't but your IP gave you away.  ;)

BTW! It's working out great for me and the users.  :D
Logged
Hawk

AdamPickett5

  • Newbie
  • *
  • Offline Offline
  • Posts: 1
    • View Profile
Re: Progress Bar
« Reply #19 on: December 29, 2010, 07:44:44 AM »

I want progress bar for PHP that works with a simple html form...is it possible? does anyone have any idea about it?
 

+ Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.
Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What is the answer to one plus one? (in numbers):