First line takes a Ruby object of a class StringIO(not String!) that’s something like a mutant, a mix between an IO object and a String, but none of them… weird class, here is the file that user uploads.

Second line it’s the name(path included) which we are to save the file into the server, yes, this is just a String.

Now we want to save the file in the server, to do that we just take the original file and write it’s content to the server file:

Related

thanks. everyone is past cgi, but im just learning. started with rails but then had to start over because i wanted to know what it was doing. so first i figure out the basics of form=>cgi=>ruby. then i move on to rack, then get back into rails