Skip to content

Instantly share code, notes, and snippets.

@codethug
codethug / Example.html
Created June 27, 2019 21:42 — forked from Danielku15/Example.html
A MediaTypeFormatter for WebApi for multipart/form-data including file uploads
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>File Upload example</title>
<link href="/Content/bootstrap.css" rel="stylesheet" />
</head>
<body>
<form action="api/Upload" method="post">
<div class="form-group">
/*
* read-only date display with momentjs
* use like this: data-bind="moment: dateVar, format: 'YYYY-MM-DD'"
* The "format" is optional and will default to "MM/DD/YYYY"
*/
ko.bindingHandlers.moment = {
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
var val = valueAccessor();
var date = moment(ko.utils.unwrapObservable(val));