4 Replies Latest reply on Jun 9, 2006 3:49 AM by Newsgroup_User

    Upload files: enabling folder write permission with PHP

    Level 7
      hi:

      i'm testing the Flash FileReference class to select files for upload to
      a server through a PHP script

      so far so good provided that the folder where the files are going to be
      uploaded exists and has write permission enabled for everybody. but what
      about if i need to upload to a new folder or it already exists but only
      the owner has write permissions as when you create it with Dreamweaver?

      i've tried this script without success. i'm testing locally in a Mac but
      the remote server is a Windows one

      tia,

      jdoe

      <?php
      $MAXIMUM_FILESIZE = 1024 * 50; // 50KB

      if (!is_dir("./images")) mkdir("./images", 0777);

      if ($_FILES['Filedata']['size'] <= $MAXIMUM_FILESIZE) {
      move_uploaded_file($_FILES['Filedata']['tmp_name'],
      "./images/".$_FILES['Filedata']['name']);
      }
      ?>