Hi all,
I'm using IgniteUI v13.1 and ASP.NET 4.0 (not MVC)
I'm developing a web app that takes a CSV file, and must upload it to the server to be processed, and then return some data to be displayed in an igGrid.
I see the igUpload control has a "posturl" property, is there some way I can use this to post the file directly to my WCF RESTful service?
If not, how can I get the file to my WCF service so I can process and return the data?
Any tips/hints would be appreciated!
Thanks,
Regards,
Hi, Eduard.
Thanks for using our products and let me see if I can help you.
I suppose you are talking about the progressUrl property. And I think you cannot set it directly to a WCF RESTful service, unless you implement that service to receive chunks of the file and save it to the server. When using igUpload, it comes with already implemented server side that handles this. But the url should reference HTTP Handler on the server. Along with the HTTP module, both save and manipulate the server part of igUpload. If you want to use something different from HTTP Module and Handler, you should implement it yourself.
But having the Infragistics.Web.Mvc dll on the server, you just need to put the URL to "IGUploadStatusHandler.ashx" and the file should be saved on the server. I guess you've already read the tutorials. Then you can read it, with the service, and send the data back to the client.
I will wait for your feedback.
Nikolay Alipiev
Was my answer helpful for you? Don't hesitate to ask me if you have more questions. In the meantime if you found a solution we will be happy if you share it with us.
Best regards,
Hi,
Thanks for the feedback. I've been busy so haven't had an opportunity to reply yet.
What I did originally was to change thepostUrlproperty of the igUpload to post directly to my WCF service, and set up the receiving method to take the data as a Stream parameter.
On the server I then transformed and loaded the file into a Stream object and processed my data like that.
Here is my igUpload control's markup/definition:
$.ig.loader({ ready: function () { $("#fileUploader").igUpload({ mode: "single", progressUrl: "/IGUploadStatusHandler.ashx", uploadUrl: webServiceURL + "Upload/", labelAddButton: "1. Import Leads from File", labelUploadButton: "1. Import Leads from File", maxSimultaneousFilesUploads: 1, autostartupload: true, allowedExtensions: ["csv"], //Only allow CSV files... width: "100%", multipleFiles: false, onError: uploadError, fileUploaded: uploadComplete, fileUploading: uploading }); } });
Where "webServiceUrl" points to my WCF REST service.
In my REST service I parse the data from the Stream object using a custom parser class, get the byte data, write it to a MmeoryStream object, and process it.
This works in both v13.1 and v13.2 of IgniteUI.
Hope this helps someone else out there.
Thank you very much for the solution.
Nikolay