Seven price
asked on
flow.js upload file on click passing null
Trying to pass the file to controller public ActionResult Save(IEnumerable files) but I keep passing null.
$scope.flow = {}
$scope.uploadme = function (e) {angular.forEach(e, function (flow) {
var fd = new FormData();
fd.append("file", flow);
$http.post("/Save", fd, {
withCredentials: true,
headers: { 'Content-Type': undefined },
transformRequest: angular.identity
})
});
}
######################################### Client html
<div flow-init flow-name="obj.flow"
flow-file-success="$file.msg = $message">
<input type="file" name="xlfile" flow-btn />
<input type="button" value="Click Me" ng-click="uploadme($flow)">
<table>
<tr ng-repeat="file in $flow.files">
<td>{{$index+1}}</td>
<td>{{file.name}}</td>
<td>{{file.msg}}</td>
</tr>
</table>
I have uploaded files: #{{flow.files.length}}
</div>
ASKER
Good question answer. Not to sure. Maybe something like e.file.target. do you have example with my current code would help me understand.
I haven't the slightest idea of what you are trying to achieve. You might try starting from the top. If you are trying to pick things out of a list, you'll need to initailze the list first. And don't make the pick list the target list at the same time!
ASKER
I am just trying to upload a file to my directory. Thats all.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is a try. I will implement this and let you know before I close. Thank you for lending out your hand of suggestions.
ASKER
I tried to close it and give points but there is no way to give points. Nothing is showing
Let tagit close it.
Anyway did you implement one of my suggestions?
Anyway did you implement one of my suggestions?
ASKER
Ng upload worked great for me. Thanks again.
The way it stands at the moment, when you press the button "Click me", the empty object is passed fo uploadme which will do absolutely nothing.
So, how do we select "files" and "msgs" to put them into an array?
(BTW why enumerate $flow (=e in uploadme), when you append $flow to fd???)