Skip to content

Instantly share code, notes, and snippets.

@s-hiroshi
Created June 24, 2012 12:35
Show Gist options
  • Save s-hiroshi/2983102 to your computer and use it in GitHub Desktop.
Save s-hiroshi/2983102 to your computer and use it in GitHub Desktop.
PHP > file upload
<?php
if (is_uploaded_file($_FILES["upfile"]["tmp_name"])) {
// echo $_FILES["upfile"]["name"] . "をアップロードしました。";
// print('<img src="' . $_FILES["upfile"]["tmp_name"] . '">');
echo $_FILES["upfile"]["tmp_name"];
} else {
// echo "ファイルが選択されていません。";
}
?>
<form action="index.php" method="post" enctype="multipart/form-data">
File<br />
<input type="file" name="upfile" size="30" /><br />
<br />
<input type="submit" value="Image upload" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment