Skip to content

первый#1

Open
mirzhil wants to merge 1 commit intomainfrom
first-iteration
Open

первый#1
mirzhil wants to merge 1 commit intomainfrom
first-iteration

Conversation

@mirzhil
Copy link
Copy Markdown
Owner

@mirzhil mirzhil commented Aug 10, 2025

No description provided.

Copy link
Copy Markdown

@ivannizh ivannizh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Владимир, привет!

Хорошая работа, загрузка файла работает и происходить перекодирование.

Принято!


// обязательно multipart/form-data
if err := r.ParseMultipartForm(10 << 20); err != nil { // 10 MB
http.Error(w, err.Error(), http.StatusInternalServerError)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это ошибка клиента

Suggested change
http.Error(w, err.Error(), http.StatusInternalServerError)
http.Error(w, err.Error(), http.StatusBadRequest)

// читаем РОВНО из "myFile"
file, header, err := r.FormFile("myFile")
if err != nil {
http.Error(w, "file field 'myFile' not found: "+err.Error(), http.StatusInternalServerError)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
http.Error(w, "file field 'myFile' not found: "+err.Error(), http.StatusInternalServerError)
http.Error(w, "file field 'myFile' not found: "+err.Error(), http.StatusBadRequest)

// читаем входные данные
data, err := io.ReadAll(file)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
http.Error(w, err.Error(), http.StatusInternalServerError)
http.Error(w, err.Error(), http.StatusBadRequest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants