Использование виджета загрузки Kendo UI, как загрузить загруженные файлы в службу сервиса wcf. Предоставляет параметр saveUrl с моим методом wcf, но не уверен, как получить загруженные данные файла. Все еще не в состоянии понять цель опции saveField. Пожалуйста, предложите.Kendo UI Upload widget - saveField и saveUrl
//// декларация службы общедоступный интерфейс ISampleWcf { [OperationContract] [WebGet (Bodystyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] недействительными DoWork();
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
void SaveAttachments(List<HttpPostedFileBase> files);
}
//// Реализация услуг.
public class SampleWcf : ISampleWcf
{
public void DoWork()
{
}
public void SaveAttachments(List<HttpPostedFileBase> files)
{
//HttpPostedFile file;
var current = System.Web.HttpContext.Current;
if(current != null)
{
var f = current.Request["files"];
}
}
}
//// Jquery скрипт
$("#files").kendoUpload({
async: {
saveUrl: "SampleWcf.svc/SaveAttachments",
saveField: "customSaveField",
autoUpload: true
},
success: onSuccess,
error: onError
});
function onSuccess(e) {
alert('s');
}
function onError(e) {
// Array with information about the uploaded files
var files = e.files;
if (e.operation == "upload") {
alert("Failed to upload " + files.length + " files");
}
}
/////Web.Config файл
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="serviceBehavior" name="WebApplication1.SampleWcf">
<endpoint address="" contract="WebApplication1.ISampleWcf" behaviorConfiguration="webSupport"
binding="webHttpBinding" bindingConfiguration="webServiceBinding" name="jsonEndPoint">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webSupport">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webServiceBinding" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="34" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
</system.serviceModel>
</configuration>
Любые предложения, пожалуйста – Mallikarjun