公告版位
需要找什麼嗎? 左邊分類或許可以幫助你...

package main

import (
    "net/http"
    "fmt"
)

func loadin(w http.ResponseWriter, r *http.Request) {
    username := r.FormValue("username")
    password := r.FormValue("password")
    fmt.Fprintf(w,"<html><body>");
    fmt.Fprintf(w, "Hello, %s ! <br/>", username)

黃彥霖 發表在 痞客邦 留言(0) 人氣()

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

    public Texture2D t; // 將外部圖片套用至此處,圖片要到 Advanced 設定為可讀可寫才行喔 (否則會失敗)

    IEnumerator Start () {
        WWWForm wwwF = new WWWForm ();
        wwwF.AddBinaryData ("file", t.EncodeToPNG (), "A.png");
        WWW www = new WWW ("http://127.0.0.1:8080/upload", wwwF);
        yield return www;
        print ("Upload Finish !!");

黃彥霖 發表在 痞客邦 留言(0) 人氣()


先建立一個 index.html 檔,把下面 HTML 語法複製貼上,再將 html 檔移動到 Golang 專案下

<html>
<head>
<title>Golang upload</title>
</head>
<body>
<form id="uploadForm" method="POST" enctype="multipart/form-data" action="http://127.0.0.1:8080/upload">
<p>Golang upload</p>
<input type="FILE" id="file" name="file" />

黃彥霖 發表在 痞客邦 留言(0) 人氣()

using UnityEngine;
using System.Collections;
using System.Net;

public class NewBehaviourScript2 : MonoBehaviour {

void Start () {
WebClient wc = new WebClient();
wc.DownloadFile("http://27.105.18.141/img/A.mp3", "C:/Audio/A.mp3");
}

}

黃彥霖 發表在 痞客邦 留言(0) 人氣()

package main

import (
    "fmt"
    "net/http"
)

func index(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "<h1>Hello %s!</h1><br><br><image src=/img/A.jpg />", r.URL.Path[1:])
}

func img(w http.ResponseWriter, r *http.Request) {
    http.ServeFile(w, r, r.URL.Path[1:])

黃彥霖 發表在 痞客邦 留言(0) 人氣()