Jump to content

ninabarley

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ninabarley's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. :facewall:I'm pulling my hair out...I've written a simple php file upload, and it seems to work fine. But once the file is in the directory, I get a 403 Forbidden error on it. I'm pretty sure it's because the permissions on it are wrong, but I don't know how to direct PHP to set it so that the file can be read when I link to it in my HTML (or any other way). Here's the code I used: <form action="<?php print $PHP_SELF?>" enctype="multipart/form-data" method="post"> Daily Bulletin: <input type="file" name="daily_bulletin" value="" /><br /> <p><input type="submit" name="submit" value="Upload New Daily Bulletin" /></p> </form> <?php define ("FILEREPOSITORY","./"); if (is_uploaded_file($_FILES['daily_bulletin']['tmp_name'])) { if (($_FILES['daily_bulletin']['type'] = "application/pdf") || ($_FILES['daily_bulletin']['type'] = "application/x-pdf")) { $extension = end(explode('.', $_FILES['tmp_name'])); $allowed = array('pdf', 'pdfx'); if (in_array($extension, $allowed)) { $name = $_POST['name']; $result = move_uploaded_file($_FILES['daily_bulletin']['tmp_name'], FILEREPOSITORY."/bulletins/bulletin.pdf"); if ($result == 1) { echo "<p>File successfully uploaded.</p>"; } else echo "<p>There was a problem uploading the file.</p>"; } else { echo "<p>Daily Bulletin must be uploaded in PDF format.</p>"; } #endIF } #endIF ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.