rjp2525

Permissions Testing

May 2nd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['btnsubmit'])) {
  3.   $tmp_name = $_FILES["imagefile"]["tmp_name"];
  4.  
  5.   if(move_uploaded_file($tmp_name, "../path/to/file.png")) {
  6.     $file = "../path/to/file.png";
  7.     $permissions = 0777;
  8.  
  9.     if (!chmod($file,$permissions)) {
  10.       die('Error with CHMOD' );
  11.     }
  12.   } else { 
  13.     die("There was an error uploading the file, please try again");
  14.   }
  15. }
  16. ?>
  17. <form method="POST" enctype="multipart/form-data" id="imgsubmission" name="imgsubmission">
  18.   <input type="file" id="imagefile" name="imagefile" size="50"/>
  19.   <input type="submit" name="btnsubmit" value="Submit"/>
  20. </form>
Advertisement
Add Comment
Please, Sign In to add comment