Browse Source

Merge pull request #56 from EPICPaaS/master

Fix the first form multi-part item is not a  "file type part" problem in "ParseUpload()"
pull/58/head
chrislusf 10 years ago
parent
commit
889099ac0d
  1. 17
      go/storage/needle.go

17
go/storage/needle.go

@ -60,11 +60,20 @@ func ParseUpload(r *http.Request) (fileName string, data []byte, mimeType string
return return
} }
part, fe := form.NextPart() part, fe := form.NextPart()
if fe != nil {
glog.V(0).Infoln("Reading Multi part [ERROR]", fe)
e = fe
return
for {
if fe != nil {
glog.V(0).Infoln("Reading Multi part [ERROR]", fe)
e = fe
return
}
if part.FileName() != "" {
break //found the first <file type> multi-part
}
part, fe = form.NextPart()
} }
fileName = part.FileName() fileName = part.FileName()
if fileName != "" { if fileName != "" {
fileName = path.Base(fileName) fileName = path.Base(fileName)

Loading…
Cancel
Save