Created
September 7, 2012 02:16
-
-
Save mrosset/3662599 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 01:42 Eridius_ | true. Although you do have to remember to C.free those │ | |
| | things │ | |
| 01:44 belak | How do file uploads work with Go? Like, where is the │ | |
| | uploaded file temporarily stored and do you have to unlink │ | |
| | it if not used? │ | |
| 01:55 str1ngs | belak: depends on the server │ | |
| 01:56 str1ngs | if you control the server you need to impliment it │ | |
| 02:01 str1ngs | so any io.Writer from Request.Body would work │ | |
| 02:01 str1ngs | but MultipartReader is probably better. just more complex │ | |
| 02:04 catery | are there any blog posts on what the typical situation where │ | |
| | you would like generics and how you get around that in Go │ | |
| 02:04 belak | str1ngs: I'm currently using r.FormFile("title") │ | |
| 02:05 pietro10 | that's a funny thing │ | |
| 02:05 pietro10 | most people who talk about generics in go find they hardly │ | |
| | need genercis! │ | |
| 02:06 str1ngs | belak: do you really need to pust multiple files? │ | |
| 02:06 str1ngs | post* │ | |
| 02:08 belak | str1ngs: it's part of a form │ | |
| 02:08 str1ngs | belak: but to save to file you can do something like. │ | |
| | io.Copy(fd, mpf) │ | |
| 02:08 str1ngs | and get file name from FileHeader │ | |
| 02:10 str1ngs | where you put it is upto you really. TMPDIR or even to │ | |
| | memory │ | |
| 02:10 str1ngs | if say you use bytes.Buffer │ | |
| 02:10 belak | I just thought I remembered something like php requiring you │ | |
| | to unlink failed uploads │ | |
| 02:11 str1ngs | you might want to delete the file on io.Copy err if you use │ | |
| | a a fd. │ | |
| 02:11 catery | pietro10: can you explain to me why generics are hardly │ | |
| | needed in Go, how does it happen that some imperative │ | |
| | languages require it more than others? │ | |
| 02:13 qeed | i never found that i really need to write a container, │ | |
| | usually maps and appends are good enough │ | |
| 02:13 str1ngs | yep why they removed alot of the containers │ | |
| 02:13 str1ngs | and you can extend your slices with methods anyways. │ | |
| 02:14 Eridius_ | dammit guys, stop having conversations when I'm offline ;) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment