Skip to content

Instantly share code, notes, and snippets.

@peace098beat
Created October 8, 2014 14:39
Show Gist options
  • Save peace098beat/22f612a62f953d456ab2 to your computer and use it in GitHub Desktop.
Save peace098beat/22f612a62f953d456ab2 to your computer and use it in GitHub Desktop.
ファイルアップロードPHP | 動画、静止画に対応
<?php
/**********************************************************
/ アップロードファイルの保存
/**********************************************************/
if( $data = $_FILES["photo"] ){
move_uploaded_file( $data["tmp_name"], "./img/".date(U).$data["name"] );
// move_uploaded_file( $data["tmp_name"], "./img/".$data["name"] );
// echo("<img src='"."./img/".date(U).$data["name"]."' alt=''>");
}else{
// echo "nono";
}
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://orange.house.fififactory.com/www/index.php");
?>
<form class="form" role="form" action="post.php" enctype="multipart/form-data" method="post">
<div class="form-group">
<input class="button " type="file" name="photo" accept="image/*; capture=camera">
<input class="button sign-up" type="submit" value="UPLOAD">
</div>
</form>
<form action="post.php" enctype="multipart/form-data" method="post">
<input class="button " type="file" name="upfile" accept="image/*; capture=camera, video/*; capture=camera">
<input class="button sign-up" type="submit" value="UPLOAD">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment