Skip to content

Instantly share code, notes, and snippets.

@suziewong
Created December 9, 2013 07:17
Show Gist options
  • Save suziewong/7868503 to your computer and use it in GitHub Desktop.
Save suziewong/7868503 to your computer and use it in GitHub Desktop.
php_upload.php
<?php
if($_FILES['file']['name'] != '') {
if($_FILES['file']['error'] > 0) {
echo "错误状态:" . $_FILES['file']['error'];
} else {
$uuid = md5(uniqid(rand(), true));
move_uploaded_file($_FILES['file']['tmp_name'] , "uploads/" . $uuid . ".png");
echo "http://localhost:20001/".$uuid.".png";
}
} else{
echo "请上传文件!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment