<div dir="auto">There is no $audiofile variable in that script. <div><br></div><div><br><br>Sent from my Huawei phone</div></div><div style="line-height:1.5"><br><br>-------- Original message --------<br>From: Andrew Ramage <andrew.ramage.1963@gmail.com><br>Date: Fri, 1 May 2020, 15:19<br>To: Edinburgh Linux Users Group <edlug@lists.edlug.org.uk><br>Subject: [EdLUG] Help 3<br><blockquote>When this is run. $audiofile is null.  Could someone explain  why ?  I <br>copied an example from W3scools fpr graphics and changed variable name <br>and file types.<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>if (file_exists($target_file)) {<br>     echo "Sorry, file already exists.";<br>     $uploadOk = 0;<br>}<br><br>// Allow certain file formats<br>if($audioFileType != "mp3" && $audioFileType != "ogg")  {<br>     echo <br><br>$audioFileType;<br>     echo "Sorry, only MP3 and OGG files are allowed.";<br>     $uploadOk = 0;<br>}<br>// Check if $uploadOk is set to 0 by an error<br>if ($uploadOk == 0) {<br>     echo "Sorry, your file was not uploaded.";<br>// if everything is ok, try to upload file<br>} else {<br>     if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], <br>$target_file)) {<br>         echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " <br>has been uploaded.";<br>     } else {<br>         echo "Sorry, there was an error uploading your file.";<br>     }<br>}<br>?><br><br></body><br></html><br><br><br>-- <br>EdLUG mailing list<br>EdLUG@lists.edlug.org.uk<br>https://lists.edlug.org.uk/mailman/listinfo/edlug</blockquote></div>