我對Golang完全陌生。我正試圖從客戶端發送文件到服務器。客戶端應該將其拆分成更小的塊並將其發送到服務器公開的其餘端點。服務器應該結合這些塊並保存它。無法將數據以塊的形式發送到Golang中的服務器
這是我寫到目前爲止的client和server代碼。當我運行它來複制大小爲39字節的文件時,客戶端向服務器發送兩個請求。但服務器顯示以下錯誤。
2017/05/30 20:19:28 Was not able to access the uploaded file: unexpected EOF
2017/05/30 20:19:28 Was not able to access the uploaded file: multipart: NextPart: EOF
我不認爲表單數據是任意二進制數據的正確內容類型。我相信它應該是application/octet-stream。請參閱https://stackoverflow.com/questions/14962592/whats-content-type-value-within-a-http-request-when-uploading-content – Adrian