Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moron

macrumors newbie
Original poster
Apr 9, 2003
29
0
London
Hi,

I'm having a problem with my local OS X web server, and it's driving me insane. I'm trying to teach myself php, and I've made a script to upload a file from my machine to the server...the problem is that the upload keeps failing. At first I assumed this was a problem with my code, but there are no syntax errors and it runs flawlessly on my paid webhost. This suggests that there's something wrong with my local webserver. I've tried Googling for an answer, but with no joy....and I was hoping that someone here might be able to help.

Here's the code I'm using...

PHP:
<?php if ($_FILES['File']) { ?>
   <p>File name: <?php echo $_FILES['File']['name'] ?></p>
   <p>File size: <?php echo $_FILES['File']['size'] ?></p>
   <?php 
        if (copy ($_FILES['File']['tmp_name'], "img/$File_name")) {
         $Outcome = ("Your file was successfully uploaded!");
     } else {
         $Outcome = ("Your file could not be copied.");
     }
     unlink ($_FILES['File']['tmp_name']);
    ?>
    <p><?php echo $Outcome ?></p>
<?php } ?>

<p>Upload a file to the server:</p>
<form action="uploadtest2.php" method="post" enctype="multipart/form-data">
   <!-- allow browsers to detect when file > max file size -->
   <input type="hidden" name="MAX_FILE_SIZE" value="20000000000" />
   <input type="file" name="File" size="20"><br />
   <input type="submit" name="SUBMIT" value="Submit!">
</form>

I've chmod 777 the 'img' folder, so I don't think it's a permissions issue. :|

The server is running OS X 10.3.9 with the Entropy php package.

If anyone could perhaps speculate why this is happening, I'll be eternally grateful! :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.