Skip to content

Instantly share code, notes, and snippets.

@akirayou
Created December 22, 2017 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akirayou/c12b83a3810e07ec03b54068cb001b53 to your computer and use it in GitHub Desktop.
Save akirayou/c12b83a3810e07ec03b54068cb001b53 to your computer and use it in GitHub Desktop.
<?php
header('Content-type: text/plain; charset=utf-8');
$uploaddir = '/home/akira/public_html/up/';
$id= uniqid();
if(isset($_POST['name']) && (0==preg_match("/[^0-9a-zA-Z]/",$_POST['name']) )){
$id=$_POST['name'];
}
$uploadfile = $uploaddir .$id.".bin";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "http://10.0.1.108/~akira/up/".$id.".bin\n";
} else {
echo "ERROR";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment