FAQ
hi,

I upload the file via browser and I need to read that file in below
function...

func Echo(ws *websocket.Conn) {

     var err error


     for {

         var reply string


         if err = websocket.Message.Receive(ws, &reply); err != nil {

             fmt.Println("Can't receive")

             break

         }


         fmt.Println("Received back from client: " + reply)


         msg := "Received: " + reply

         fmt.Println("Sending to client: " + msg)


         if err = websocket.Message.Send(ws, msg); err != nil {

             fmt.Println("Can't send")

             break

         }

     }

I knew to read file I have to create new var as var a[]byte...

But how can I read that file?

Is it same as the way that we read file in normal web application like below?

data, err := ioutil.ReadAll(file)


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 21, '14 at 2:51p
activeJan 21, '14 at 2:51p
posts1
users1
websitegolang.org

1 user in discussion

kate Fernando: 1 post

People

Translate

site design / logo © 2021 Grokbase