[EdLUG] Help 8

Colin Shorts colin.shorts at gmail.com
Thu May 14 12:08:52 UTC 2020


I think you've also missed an echo on "Fourth if";

On Thu, 14 May 2020, 10:37 Andrew Robinson, <andrew at robinson-a.co.uk> wrote:

> A quick scan, your <br> on line 19 is html, I believe you'll need to put
> that in quotes - "<br>".
>
> You're missing a semicolon on line 32 - echo "Sorry, there was an error
> uploading your file.";
>
> ----
> Again, try using debugging errors or a sandbox as previously linked to,
> it'll should about these errors.
>
> Cheers,
>
>
> > On 14 May 2020 at 09:55 Andrew Ramage <andrew.ramage.1963 at gmail.com>
> wrote:
> >
> >
> > I still do not see a syntax error in this file:
> >
> > _upload.html_
> >
> > <!doctype html>
> >
> > <html>
> >
> >
> > <?php
> >     error_reporting(E_ALL);
> >
> >
> > $target_dir = "Music/";
> > $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
> > $uploadOk = 1;
> > $audioFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
> >
> > // Check if file already exists
> > echo "First if";
> > if (file_exists($target_file)) {
> >      echo "Sorry, file already exists.";
> >      $uploadOk = 0;
> > }
> > echo "Second if";
> > // Allow certain file formats
> > if (($audioFileType != "mp3") && ($audioFileType != "ogg"))  {
> >      echo $audioFileType .
>  . "Sorry, only MP3 and OGG files are
> > allowed.";
> >      $uploadOk = 0;
> > }
> > // Check if $uploadOk is set to 0 by an error
> > echo "Third if";
> > if ($uploadOk == 0) {
> >      echo "Sorry, your file was not uploaded.";}
> > // if everything is ok, try to upload file
> >   else {
> >      "Fourth if";
> >      if (move_uploaded_file($_FILES ["fileToUpload"]["tmp_name"],
> > $target_file)) {
> >          echo "The file ". basename(
> > $_FILES["filndow.alerteToUpload"]["name"]). " has been uploaded."; }
> >      else {
> >          echo "Sorry, there was an error uploading your file."
> >           }
> >      }
> > ?>
> >
> > </html>
> >
> > --
> > EdLUG mailing list
> > EdLUG at lists.edlug.org.uk
> > https://lists.edlug.org.uk/mailman/listinfo/edlug
>
> --
> EdLUG mailing list
> EdLUG at lists.edlug.org.uk
> https://lists.edlug.org.uk/mailman/listinfo/edlug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.edlug.org.uk/pipermail/edlug/attachments/20200514/16b5607f/attachment.html>


More information about the EdLUG mailing list