Image Upload Script....!

Discussion in 'PHP' started by strgraphics, Jun 24, 2010.

  1. #1
    i am using image upload script as....,

    
    <html>
    <head>
    </head>
    <center>
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    
    
    
    <?php
    
    $max_no_img=2; 
    
    echo "<table CLASS='hme'><td>";
    echo "<form method=post action=addimgck.php enctype='multipart/form-data' onsubmit='showLoading()'>";
    echo "<table class='inner' BORDER=0>";
    
    
    	for($i=1; $i<=$max_no_img; $i++)
    	{
    	echo "<tr><td><font COLOR='#000000' FACE='verdana' SIZE=2>Images $i</td><td>
    	<input type=file name='img[$i]' class='bginput' Id='bginput'></td></tr>";
    	}
    	
    	
    echo "<tr><td></td><td colspan=2>
    <input type=submit value='Upload Images'></td></tr>"; 
    echo "</form> </table>";
    echo "</td></table>";
    
    ?>
    
    <script LANGUAGE="JavaScript">
    function showLoading() {
         
        // Add a box to contain the message.
        var box = document.createElement('div');
        box.style.position = 'absolute';
        box.style.zIndex = '1';
        box.style.width = '250px';
        box.style.margin = '15px ' + ((document.body.offsetWidth / 2) - (250 / 2)) + 'px';
        box.style.fontFamily = 'Verdana, Arial, serif';
        document.body.appendChild(box);
     
        // Add the "Please wait" header
        var message = document.createElement('span');
        message.id = 'loading_header';
        message.style.display = 'block';
        message.style.fontSize = '120%';
        message.style.fontWeight = 'bold';
        message.style.textAlign = 'center';
        message.innerHTML = 'Please wait';
        box.appendChild(message);
     
        // Add the subheader message
        var message = document.createElement('span');
        message.id = 'loading_message';
        message.style.display = 'block';
        message.style.fontSize = '100%';
        message.style.textAlign = 'center';
        message.innerHTML = 'Your files are being uploaded.';
        box.appendChild(message);
     
        // Add a loading image.
        var img = document.createElement('img');
        img.setAttribute('src', './loading.gif');
        img.style.display = 'block';
        img.style.width = '220px';
        img.style.height = '19px';
        img.style.margin = '15px auto';
        box.appendChild(img);
       
    }
    
    </script>
    
    
    </body>
    </html>
    
    
    PHP:
    Its working fine.., when i click upload image button,
    it was showing the please wait script then adding images successfullly but..,

    But if i press back button in my opera browser..., i am seeing
    please wait script again.., how can i avoid that

    check the image hear
    [​IMG]
     
    Last edited: Jun 24, 2010
    strgraphics, Jun 24, 2010 IP
  2. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <?php
    header("Cache-Control: no-cache, must-revalidate"); 
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 
    
    
    $max_no_img=2; 
    
    echo "<table CLASS='hme'><td>";
    
    ......
    
    PHP:
     
    flexdex, Jun 24, 2010 IP
  3. strgraphics

    strgraphics Active Member

    Messages:
    710
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Appreciate you help, but i did what you say..., but friend am getting the error...!

     Warning: Cannot modify header information - headers already sent by (output started at ......\index.php:10) in ............\index.php on line 12 
    PHP:
     
    strgraphics, Jun 24, 2010 IP
  4. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, this way should work.
    
    <?php
    header("Cache-Control: no-cache, must-revalidate"); 
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 
    ?>
    <html>
    <head>
    </head>
    <center>
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    
    
    PHP:
    Just move them up to the top of your codefile
     
    flexdex, Jun 24, 2010 IP
  5. strgraphics

    strgraphics Active Member

    Messages:
    710
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #5
    Ya now no error....,

    but problem was not solved.....!
    i click on submitt button, it uploads images successfully with showing please wait... while.. blabla
    once update completed.., when i press back button in my browser, it again showing

    the please wait... while.. blabla, just like above
     
    strgraphics, Jun 24, 2010 IP
  6. Scripts man

    Scripts man Guest

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Scripts man, Jun 25, 2010 IP
  7. strgraphics

    strgraphics Active Member

    Messages:
    710
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #7
    hello Scripts man,

    whats there....., nothing don't make any fake comments please frined..,this is very important for me
     
    strgraphics, Jun 26, 2010 IP
  8. strgraphics

    strgraphics Active Member

    Messages:
    710
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #8
    Friends... any body help me to get me out ..
     
    strgraphics, Jun 28, 2010 IP
  9. frank100

    frank100 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Is this problem limited to opera or it happens in other browsers as well
     
    frank100, Jun 28, 2010 IP
  10. strgraphics

    strgraphics Active Member

    Messages:
    710
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #10
    ya its appearing in opera..., and in remaining browsers loading image not appearing...!

    Ohh..., any body suggest like this script i mean., loading on submit.
     
    strgraphics, Jun 28, 2010 IP