Permissions denied trying to upload a move a file...

From: Date: Thu, 07 Aug 2003 16:09:17 +0000
Subject: Permissions denied trying to upload a move a file...
Groups: php.general 
Request: Send a blank email to php-general+get-158666@lists.php.net to get a copy of this message
I'm using PHP version 4.2.2 on a Linux system running Apache. I am trying to allow my users to upload a file, however I continue to receive a "Permission denied" error when using move_uploaded_file() or copy(). The file appears to be sent to the temporary directory successfully, but can not be copied or moved to the uploads directory. I've used the following code to authenticate (I enter in the same username and password that I use for ftp -- which has the necessary permissions to move/copy files to the destination); -------------------------------------------------------------------------- <?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Private"'); header('HTTP/1.0 401 Unauthorized'); echo "Authentication failed.\n"; exit; } else { echo "<p>Welcome: {$_SERVER['PHP_AUTH_USER']}</p><br>"; echo "<p><form enctype='multipart/form-data' action='fileUpload.php' method='post'>\n"; echo "<input type='hidden' name='MAX_FILE_SIZE' value='30000'>\n"; echo "Send this file: <input name='userfile' type='file' >\n"; echo "<input type='submit' value='Send File'>\n"; echo "</form></p>\n"; } ?> -------------------------------------------------------------------------- The code for fileUpload.php is as follows; <?php $src = $_FILES['userfile']['tmp_name']; $dest = './characters/images/'.$_FILES['userfile']['name']; echo "<p>Welcome: {$_SERVER['PHP_AUTH_USER']}<br>"; echo "The file was temporarily uploaded to: ".$_FILES['userfile']['tmp_name']."<br>"; /* $result = move_uploaded_file($src, $dest); */ $result = copy($src, $dest); echo $result; ?> -------------------------------------------------------------------------- Could someone help me to get this working? I'd appreciate it.

« previous php.general (#158666) next »