Reputation: 1
This is a form that will go to the javascript page and will upload the photo to the server
<div class="col-sm-5" style="border-right: 1px solid #ccc">
<div class="subStyle" ng-show="showDiv1">
<form id = "uploadForm"
enctype = "multipart/form-data"
action = "/api/photo"
method = "post">
<input type="file" name="userPhoto" />
<input type="submit" value="Upload Image" name="submit">
</form>
</div>
</div>
This is the JavaScript
function
function confirmUploaded() {
res.end("File was successfully uploaded -- " + outText);
}
How would i call this function from the JavaScript
file to the HTML page
Upvotes: 0
Views: 61
Reputation: 1154
res.end is not a client side, It is a server side code and need to be send from the server end(NodeJS).
Make use of $http.success in angular and then on success attach the result to a particular div or header tags and use css for formatting.
Upvotes: 1