hi I'm very new to php all together and i have constructed a website purely by copying and pasting and working with tutorials such as this. But now I am stuck and I could really please use some help.
I have a (php)page(musicupload.php) or "page1" if you will with a form to submit the file uploads, and then a second form to run the form script and file upload (upload.php)"page2" in the background.
the script works well and does exactly what I need it to do but for some reason I can not even get the "please wait " text to appear on "page 1" where the user is waiting. I have tried everything from iframes to progress bars and after several days I am here on your page finally giving in and I think I have met the limit.
So please if you have some time have a look and please tell me where I can put the echo "please wait or even a echo url to load a flash url or something just to let the user know that his file/files are being loaded. Thank you so much for your help n advance.
chris๐Ÿ˜•

page 1:

<?php 
require_once ('login/includes/config2.inc.php'); 

// Start output buffering:
ob_start();

// Initialize a session:
session_start();

// If no first_name session variable exists, redirect the user:
if (!isset($_SESSION['first_name'])) {

$url = BASE_URL . 'login.php'; // Define the URL.
ob_end_clean(); // Delete the buffer.
header("Location: $url");
exit(); // Quit the script.

}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="layout.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
#Layer1 {
	position:absolute;
	width:313px;
	height:101px;
	z-index:1;
	left: 335px;
	top: 227px;
	visibility: visible;
	overflow: visible;
}
.style5 {
	font-size: 14;
	color: #FFFFFF;
	font-weight: bold;
}
.style7 {
	color: #00FFFF;
	font-weight: bold;
}
-->
</style>
</head>
<body id="page3">
<div align="center"></div>
<div id="main">
<div style="position:absolute; visibility: visible;">
		  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
           codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24"
           width="766" height="297">
    <param name="movie" value="flash/MusicToAfrica...swf"  /> 
    <param name="quality" value="high"  />
    <param name="menu" value="false"  />
	 <param name="wmode" value="transparent"  />
    <!--[if !IE]> <-->
    <object data="flash/MusicToAfrica...swf"
             width="766" height="297" type="application/x-shockwave-flash">
     <param name="quality" value="high"  />
     <param name="menu" value="false"  />
     <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"  />
	  <param name="wmode" value="transparent"  />
     FAIL (the browser should render some flash content, not this).
    </object>
    <!--> <![endif]-->
   </object>

</div>
	<!-- header -->
	<div id="header_menu"></div>
	<div id="header_logo"> 
	  <div align="center"><a</a></div>
	</div>
	<div id="header_form">
	  <div class="indent"></div>
	</div>
	<!-- content -->
	<div id="content">
		<div class="row_bottom">
			<div class="indent_t">
			  <div class="col_1">
						<div class="indent">
						  <div style="margin:18px 0 18px 0;"><html>
<body>

<html>
<body>



<form action="upload.php" method="post"
enctype="multipart/form-data"><br /> 
  <span class="style5">By Uploading your material to this website you  agree that you have read and understand the Artist Terms & Conditions</a>. </span><br /> 
<label for="file">Filename:<br/></label>
<input type="file" name="file" id="file" />
Mp3 only with a maximum 6Mb file size. 
<br />
<br/>Album: <br/><input name='album' type='text' />
If it's a single or EP please type in single or EP followed by the EP name. 
<br/>
<br/>
<input type="submit" name="submit" album="Submit" value="Submit" />Please allow 48 hours for processing.<br /> 
<span class="style7">When you click on submit the upload might take a while pending on your connection.<br />
Please wait because your file is then being uploaded and if any errors occur a message will be displayed.<br />
When the page reloads your upload was completed</span><br />
</form>


<?php
// Display links based upon the login status - (if user is logged in):
if (isset($_SESSION['user_id'])) {

echo '<a href="uploadartwork.php" title="Upload Your Album Artwork">Upload Your Album Artwork</a><br /><br /><br />
<a href="login/logout.php" title="Logout">Logout</a><br />
<a href="login/change_password.php" title="Change Your Password">Change Password</a><br />


';

// Add links if the user is an administrator:
if ($_SESSION['user_level'] == 1) {

	echo '<br /><h4>Administrator</h4>';
	echo '<a href="login/view_users.php" title="View Users">View Users</a><br />

';

}

} else { //  Display links if user is NOT LOGGED IN.

echo '<a href="login/register.php" title="Register for the Site">Register</a><br />
<a href="login.php" title="Login">Login</a><br />
<a href="login/forgot_password.php" title="Password Retrieval">Retrieve Password</a><br />
';

}
?>
<!--END FORM-->

</body>
</html> 

</body>
</html> 
</div>
</div>
			  </div>
				<div class="clear"></div>
			</div>
		</div>
	</div>
	<!-- footer -->

  </div>
</form>
  </div>
  <div class="cse-branding-logo">
    <img src="http://www.google.com/images/poweredby_transparent/poweredby_000000.gif" alt="Google" />
  </div>
  <div class="cse-branding-text">
    Custom Search
  </div>
</div>


 <script type="text/javascript"><!--
google_ad_client = "pub-7570968342219249";
/* 468x60, created 21/03/10 */
google_ad_slot = "1090134176";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

  </div>
</form></div>
	<div align="center"><!-- Facebook Badge START --></div>	
</body>

</html>
<?php // Flush the buffered output.
ob_end_flush();
?>

page 2 or php script form:

<?php 
require_once ('login/includes/config2.inc.php'); 

// Start output buffering:
ob_start();



// Initialize a session:
session_start();



// If no first_name session variable exists, redirect the user:
if (!isset($_SESSION['first_name'])) {

$url = BASE_URL . 'login.php'; // Define the URL.
ob_end_clean(); // Delete the buffer.
header("Location: $url");
exit(); // Quit the script.

}



if ((($_FILES["file"]["type"] == "audio/mpeg")
|| ($_FILES["file"]["type"] == "audio/x-mpeg")
|| ($_FILES["file"]["type"] == "audio/mp3")
|| ($_FILES["file"]["type"] == "audio/x-mp3")
|| ($_FILES["file"]["type"] == "audio/mpeg3")
|| ($_FILES["file"]["type"] == "audio/mpeg")
|| ($_FILES["file"]["type"] == "audio/x-mpeg3")
|| ($_FILES["file"]["type"] == "audio/x-mpeg")
|| ($_FILES["file"]["type"] == "audio/mpg")
|| ($_FILES["file"]["type"] == "audio/x-mpegaudio")
|| ($_POST["file"]["type"] == "album/txt"))
&& ($_FILES["file"]["size"] < 8000000))
  {
  if ($_FILES["file"]["error"] > 0)  
{ echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Please Wait. This might take some time pending on the connection."; flush(); if (file_exists($_SESSION['first_name'] . "/" . $_POST["album"] . "/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { mkdir("artist/"); mkdir("artist/" . $_SESSION['first_name']); mkdir("artist/" . $_SESSION['first_name'] . "/" . $_POST["album"]); move_uploaded_file($_FILES["file"]["tmp_name"], "artist/" . $_SESSION['first_name'] . "/" . $_POST["album"] . "/" . $_FILES["file"]["name"]); echo "Thank you for submitting your music, please allow 48 hours for processing"; $url = 'http://www.somesite.com/uploadmusic.php'; // Define the URL. ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. } } } else { echo "Invalid file"; } ?>

What I would really like is a progress bar of some sort but for now untill i can figure it out even a please wait animation would do just fine.
Thank you so much for your time once again.
Chris

MOD EDIT: PHP bbcode tags added; please use these in the future when posting PHP code!

    for my file uploads i use js to swap the submit button with a please wait message. This forum does much the same thing when you submit a post.

      Hey,

      Here is how I would generally do it. If you want a great tool for making 'ajax' like loaders, try out http://www.ajaxload.info/

      
      <div id="pleasewait" style="display:none;">
      
      <img src="loader.gif" alt="loading"/>
      
      </div>
      
      

      So on my form, I would have an onclick to a function, like :

      <form action="submit.php" method="post" onsubmit="showloader();">
      
      </form>

      I would have my javascript functions as such

      function showloader() { 
      
      document.getElementByID('pleasewait').style.display='';
      
      }
      
      function hideloader() { 
      
      document.getElementByID('pleasewait').style.display='none';
      
      }
      
      
      }

      then at the end of your submission, simply call the hide function

      
      <script type="text/javascript">
      
      hideloader(); 
      
      </script>
      

      If you want the image to show inside of an iframe, simply change the following

      document.getElementById("myiframe").document.getElementById("showloader").style.display='none';

      etc etc.
      I just typed this on the fly in the browser but it should work, gimme a shout if not.

      Cheers

        thank you so much i'll give it a go

          Hi there,
          no this did not work or i'm doing it wrong , do i need to include any special links to java script pages?
          if you look at my page that I gave with the thread, do you see anything that might prevent this script from working?
          happy easter๐Ÿ™‚

            drakos33;10948430 wrote:

            Is there a php salution perhaps?

            no, as php is server side, what you need is client side ie javascript and html etc.

              drakos33;10948429 wrote:

              Hi there,
              no this did not work or i'm doing it wrong , do i need to include any special links to java script pages?
              if you look at my page that I gave with the thread, do you see anything that might prevent this script from working?
              happy easter๐Ÿ™‚

              can you provide a link to the page on a site.

                Hi Dragon
                Thanx for the quick reply...happy eaaster.
                Do you mean like a link to my website http://www.musictoafrica.com the page is on the music upload page but you have to be loged in to get there

                  as half the site is already in flash, why not use a flash upload, that will do all this for you?

                    yes I have thaught of this idea , this will bring me back to a new drawing board and having to learn how to put flash and php together. I think this will be the option for me. I'll give it a go, what's bothering me is that i have constructed the back en php script that automatically outs the files where I want according to the inputfield information and i dont want to loose that function.

                      but i need a progress bar or even jus an animation and it seems php can't do all of this by itself

                        drakos33;10948440 wrote:

                        but i need a progress bar or even jus an animation and it seems php can't do all of this by itself

                        as i said before, no, as php is server-side, it knows nothing about the client, which you want to show the progres bar to.

                          Write a Reply...