18-transform

command
v0.0.0-...-56ad08b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 8 Imported by: 0

README

Gophercises - 18 - Image Transformer

Problem

Solution

Lessons Learned

HTML Input type File

We can use something like this

<input type="file"
    id="upload" name="upload"
    accept="image/jpeg,image/png" />

This only shows files of type jpeg and png. We can also do image/* to show all images.

Int to Enum

Assuming we have this enum:

type EnumType int

const (
	Zero Enum = iota
	One
	Two
	Three
)

We can convert an int to this type with EnumType(2).

http.Request.FormFile

Gets the first file in the param (usually POST body).

file, header, err := r.FormFile("upload")

Response.PostForm is a map of url.Values (map[string][]string).

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL