ความคิดเห็น: บทความนี้ส่วนใหญ่แนะนำตัวอย่างตัวอย่างของการอัปโหลดรูปภาพ HTML5 เพื่อนที่ต้องการมันสามารถอ้างถึงมันได้
<! doctype html>
<html lang = "zh-cn">
<head>
<meta charset = "utf-8" />
<meta content = "edielei" /> >>
<title> HTML5 อัพโหลดภาพตัวอย่าง </title>
<script type = "text/javascript" src = "<a href =" http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js "> </script"> "
<script type = "text/javascript">
$ (function () {
$ ('#img') เปลี่ยน (ฟังก์ชัน () {
var file = this.files [0]; // เลือกไฟล์ที่อัปโหลด
var r = new filereader ();
r.readasdataurl (ไฟล์); // base64
$ (r) .load (function () {
$ ('div'). html ('<img src = "' + this.result + '" />');
-
-
-
</script>
</head>
<body>
<H3> HTML5 อัพโหลดภาพตัวอย่าง </h3>
<input type = "file" accept = "image /*" />
<div> </div>
</body>
</html>