Jump to content

[SOLVED] File Upload: permission denied


monkeypaw201

Recommended Posts

so, i use the following script:

 

<?
if(isset($_FILES['zip'])){
require_once('pclzip.php'); 

$upload_dir = $_POST['state']; 
$filename = $_FILES['zip']['name'];

//move file
if(move_uploaded_file($_FILES['zip']['tmp_name'], $upload_dir.'/'.$filename)){
     echo "<em>Uploaded ". $filename . " - ". $_FILES['zip']."</em><br />";
}else{
  die("<font color='red'>Error : Unable to upload file</font><br />");}

$zip_dir = substr(basename($filename, ".zip"),4,4); 

if(!@mkdir($upload_dir.'/'.$zip_dir, 0777))
  die("<font color='red'>Error : Unable to create directory</font><br />");

$archive = new PclZip($upload_dir.'/'.$filename);

if ($archive->extract(PCLZIP_OPT_PATH, $upload_dir.'/'.$zip_dir) == 0)
  die("<font color='red'>Error : Unable to unzip archive</font>");

$list = $archive->listContent();
echo "<br /><b>Files unzipped and added:</b><br />";
for ($i=0; $i<sizeof($list); $i++) {

  if(!$list[$i]['folder'])
   $bytes = " - ".$list[$i]['size']." bytes";
  else
   $bytes = "";
  
  echo "".$list[$i]['filename']."<br />";
}

unlink($upload_dir.'/'.$filename); 

}

include_once("upload.html");
?>

 

and recieve the following errors.. not sure whats wrong, it worked 4 times and then began throwing errors...

 

Warning: move_uploaded_file(/day-K4A9_20080613165714.zip) [function.move-uploaded-file]: failed to open stream: Permission denied in /upload.php on line 9

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpTVYjCk' to '/day-K4A9_20080613165714.zip' in /upload.php on line 9

Error : Unable to upload file

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.