<div dir="ltr"><div>There are a couple errors I can see here right off the bat.</div><div><br></div><div>The most important one though, would be that you don't seem to have turned on debugging messages for being sent to the browser, because they are clear syntax errors, and would have appeared to you ...! ;-)<br></div><div><br></div><div>Include this at the top of the PHP file:</div><div><br></div><div><pre class="gmail-chroma"><code class="gmail-language-output"><?php
error_reporting(E_ALL);
?><br></code></pre></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><br></div><div>Then run your code again. The error reporting should display and make debugging easier. :-)<br></div><div><br>===<br>Tai Kedzierski<br></div><div>Linux Operations and Deployments Engineer<br></div><br><div dir="ltr"><span></span><font size="1"><br>I use <a href="https://www.libreoffice.org/" target="_blank">LibreOffice</a> , a free, Freedom-respecting replacement for MS Office<br><br><i>Open Source Free Software is a matter of liberty, not price.</i><br>
<a href="https://www.fsf.org/about/what-is-free-software" target="_blank">https://www.fsf.org/about/what-is-free-software</a><br></font><font size="2"><br></font></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 12 May 2020 at 14:49, Andrew Ramage <<a href="mailto:a.ramage@blueyonder.co.uk">a.ramage@blueyonder.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  

    
  
  <div>
    <p>I cannot understand why my site uploads a file then stops
      working.  Is something wrong with the HTML ?</p>
    <p><u>HTML</u></p>
    <p><br>
      <form action="upload.php" method="post"
      enctype="multipart/form-data"><br>
          <input type="file" name="fileToUpload" id="fileToUpload"
      multiple><br>
          <input type="submit" value="Upload music file"
      name="submit"><br>
      </form><br>
    </p>
    <p><u>upload.php</u></p>
    <p><!doctype html><br>
      <br>
      <html><br>
      <body><br>
      <br>
      <br>
      <?php<br>
      $target_dir = "Music/";<br>
      $target_file = $target_dir .
      basename($_FILES["fileToUpload"]["name"]);<br>
      $uploadOk = 1;<br>
      $audioFileType =
      strtolower(pathinfo($target_file,PATHINFO_EXTENSION));<br>
      <br>
      // Check if file already exists<br>
      echo "First if";<br>
      if (file_exists($target_file)) {<br>
          echo "Sorry, file already exists.";<br>
          $uploadOk = 0;<br>
      } <br>
      echo "Second if";<br>
      // Allow certain file formats<br>
      if (($audioFileType != "mp3") && ($audioFileType !=
      "ogg"))  {<br>
          echo $audioFileType . <br> . "Sorry, only MP3 and OGG
      files are allowed.");<br>
          $uploadOk = 0;<br>
      } <br>
      // Check if $uploadOk is set to 0 by an error<br>
      echo "Third if";<br>
      if ($uploadOk == 0) {<br>
          echo "Sorry, your file was not uploaded."; <br>
      // if everything is ok, try to upload file<br>
       else {<br>
          "Fourth if";<br>
          if (move_uploaded_file($_FILES ["fileToUpload"]["tmp_name"],
      $target_file)) {<br>
              echo "The file ". basename(
      $_FILES["filndow.alerteToUpload"]["name"]). " has been uploaded.";
      } <br>
          else {<br>
              echo "Sorry, there was an error uploading your file." }<br>
      <br>
      ?><br>
      <br>
      </body><br>
      </html><br>
      <br>
    </p>
  </div>

-- <br>
EdLUG mailing list<br>
<a href="mailto:EdLUG@lists.edlug.org.uk" target="_blank">EdLUG@lists.edlug.org.uk</a><br>
<a href="https://lists.edlug.org.uk/mailman/listinfo/edlug" rel="noreferrer" target="_blank">https://lists.edlug.org.uk/mailman/listinfo/edlug</a></blockquote></div>