-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
71 lines (58 loc) · 3.46 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="canonical" href="https://upload-ipfs.tokiwadai.school" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0" />
<!-- BEGIN OPENGRAPH -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://upload-ipfs.tokiwadai.school" />
<meta property="og:site_name" content="Upload IPFS with Cloudflare IPFS Gateway" >
<meta property="og:title" content="Upload IPFS with Cloudflare IPFS Gateway" >
<meta property="og:description" content="IPFS에 쉽게 파일을 올려봐요 ㅎㅎ" >
<meta property="og:image" content="https://media.discordapp.net/attachments/712357246071210087/782633609331736596/9k.png" >
<!-- END OPENGRAPH -->
<!-- BEGIN TWITTERCARD -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@Upload_IPFS_with_Cloudflare_IPFS_Gateway">
<meta name="twitter:title" content="Upload IPFS with Cloudflare IPFS Gateway" >
<meta name="twitter:description" content="IPFS에 쉽게 파일을 올려봐요 ㅎㅎ" >
<meta property="twitter:image" content="https://media.discordapp.net/attachments/712357246071210087/782633609331736596/9k.png" >
<!-- END TWITTERCARD -->
<title>Upload IPFS with Cloudflare IPFS Gateway</title>
<meta name="author" content="zeroday0619" />
<meta name="title" content="Upload IPFS with Cloudflare IPFS Gateway" />
<meta name="copyright" content="Copyright 2020. zeroday0619 all rights reserved."/>
<meta name="description" Content="IPFS에 쉽게 파일을 올려봐요 ㅎㅎ" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script src="https://unpkg.com/ipfs-http-client@30.1.3/dist/index.js"></script>
<script src="https://bundle.run/buffer@5.2.1"></script>
</head>
<body>
<h3>Upload file to IPFS using Infura Pinning Service and Cloudflare IPFS Gateway</h3>
<h4>Permanently upload your files to the IPFS network</h4>
<input type="file" id="upload">
<div id="link"></div> <!-- markup created after upload -->
<script>
const ipfs = window.IpfsHttpClient('ipfs.infura.io', '5001', { protocol: 'https' });
$("#upload").on("change", function () {
document.getElementById("link").innerHTML = "Starting upload...";
var reader = new FileReader();
reader.onload = function (e) {
document.getElementById("link").innerHTML = "Uploading file to Infura...";
const magic_array_buffer_converted_to_buffer = buffer.Buffer(reader.result);
ipfs.add(magic_array_buffer_converted_to_buffer, (err, result) => {
console.log(err, result);
let ipfsLink = "<a target='_blank' href='https://cloudflare-ipfs.com/ipfs/" + result[0].hash + "'>cloudflare-ipfs.com/ipfs/" + result[0].hash + "</a>";
document.getElementById("link").innerHTML = ipfsLink;
})
}
reader.readAsArrayBuffer(this.files[0]);
})
</script>
<footer>
Created by <strong><a href="https://twitter.com/BawAppie">@BawAppie</a></strong> / Powered by <strong><a href="appie.design">Appie.Design</a></strong>
</footer>
</body>
</html>