Re: [go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-16 Thread Steven Hartland
If your file out code is above your original code snippet so you have something like: https://play.golang.org/p/5MVxJamHy4c Then one of the problems is the file pointer of "out" points to the end of your file not the beginning. If you don't need the file on disk then something like the follow

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-15 Thread maksach
err = out.Close() if err != nil { fmt.Println(err) } When I add this code after the io.Copy line, it gives me this error (attached screenshot to the email). It says upload multipart failed, failed to compute body hashes, and file already closed. I moved both the file.Close() and out.Close() li

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-15 Thread 'Ingo Oeser' via golang-nuts
You seem to ignore the error from out.Close() What is out.Close reporting after the io.Copy? -- 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+unsubsc

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-14 Thread maksach
Hi, If I set Body to the out file itself, an item with the name of the outfile is uploaded to the S3 bucket, but that item is 0 bytes in size and when I click on it in S3 it doesn't appear, whereas with the buffer stuff, the image size in bytes is correct, but a black square shows up. This is h

[go-nuts] Re: AWS S3 Image Upload with Golang

2018-08-14 Thread helloPiers
It's not clear what the type of "out" is, other than it has Stat() and Read([]byte) methods, but, assuming it's an io.Reader at least, if you examine the return values from Read, like: n, err := out.Read(buffer) you may get a clue to what's going wrong, for example n might not be the full size