Skip to content

Commit

Permalink
Added security for uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaNattestad committed May 31, 2016
1 parent c2dc9e0 commit 89e54ef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,5 +1,8 @@
user_data/*
!user_data/.htaccess
user_uploads/*
!user_uploads/.htaccess

!user_data/example*
!user_data/index.html
!user_uploads/index.html
Expand Down
10 changes: 1 addition & 9 deletions file_upload.php
@@ -1,16 +1,8 @@
<?php


$code = $_POST["code_hidden"];
$code = escapeshellarg($_POST["code_hidden"]);
$name = "./user_uploads/" . $code;

move_uploaded_file($_FILES['file']['tmp_name'], $name);

////for debugging:
//file_put_contents( 'yowtf', print_r($_POST["code_hidden"], true));
//
//
//file_put_contents( 'yohai', print_r($name, true));
//

?>
2 changes: 2 additions & 0 deletions user_data/.htaccess
@@ -0,0 +1,2 @@
php_flag engine off

2 changes: 2 additions & 0 deletions user_uploads/.htaccess
@@ -0,0 +1,2 @@
php_flag engine off

0 comments on commit 89e54ef

Please sign in to comment.