Closed cgarciae closed 9 years ago
If the form element was read as a String, then the request is not multipart, or the corresponding form element is a text input, not a file input. Check if the form used to upload the file has the enctype='multipart/form-data'
attribute, and the corresponding element is a file input.
@luizmineo Sadly enctype
is multipart/form-data
and the input is of type file. Somewhere along the way its converting text files to string.
<form class="panel" enctype="multipart/form-data">
<input name="file" type="file"><br>
<button class="button tiny radius" ng-click="uploadModel (info, 'xml', $event)">
Upload
</button>
</form>
I am doing something like this to send the form
HttpRequest.request
(
path,
method: method,
sendData: new dom.FormData (form)
)
where form is the FormElement
.
You are right. text files are being converted to strings. To keep compatibility with the http_server
package, I've changed HttpBodyFileUpload.content
to dynamic. This fix is available in Redstone v0.5.21
Hadn't seen this. Thanks a lot!!! I'd been creating extensionless files as a fix. Will test right now :)
@luizmineo The .content
problem was solved, but now I am getting a similar problem when trying to upload an xml
type 'String' is not a subtype of type 'List' of 'data'.
Now .data
is the problem.
Can you try this in v0.6.0-beta.1?
@luizmineo Ok, I'll get that version. Any braking changes?
I've setup my route to accept file uploads
and it works fine for most file types except "text" files like
.txt
or.xml
. I specifically need to upload an xml as a normal file to store it inGridFS
so my clients can download the file later. I am getting this errorIt seems that its interpreting the file as a
String
.