Can I get a complete walk thru of how to get upload working? I'm gone through entire online documentation and it is scattered. There doesn't seem to be a troubleshooting area. Here's what we have so far:
I've added this in the web config:
<appsettings> <add value="~/Uploads" key="fileUploadPath" /> <add value="100000000" key="maxFileSizeLimit" /> </appsettings> <handlers> <add type="Infragistics.Web.Mvc.UploadStatusHandler" name="IGUploadStatusHandler" precondition="integratedMode" verb="*" path="IGUploadStatusHandler.ashx" /> </handlers>
Future Suggestion: Possibly prefix the company name with the settings to prevent naming collisions. Such as "Infragistics:fileUploadPath".
I've added this in the global.asax:
UploadProgressManager.Instance.AddFileUploadingEventHandler("igProductUpload", (s, e) => { }); UploadProgressManager.Instance.AddFinishedUploadEventHandler("igProductUpload", (s, e) => { }); UploadProgressManager.Instance.AddFinishingUploadEventHandler("igProductUpload", (s, e) => { }); UploadProgressManager.Instance.AddStartingUploadEventHandler("igProductUpload", (s, e) => { });
No breakpoints ever fire.
I've added this in the client:
$("#igProductUpload").igUpload({ mode: "single" });
Testing locally in a Visual Studio Development Server, I can select a file and click upload. The file looks like it uploads VERY FAST! But I don't see any fiddler logs nor do I see a file being upload to the BIN folder or do any of the events fire.
So what I am missing? How do I troubleshoot this further?
Hello Karthik,
Thank you for posting in our forum.
If you’re defining the upload in a MVC view I would advise you to define it via the MVC wrapper as opposed to directly defining in javascript, since the MVC wrapper adds some additional options like the ControlID property(http://help.infragistics.com/jQuery/2015.2/ui.igupload#options:controlId ) which relates the control’s requests with the server-side event handlers. So in order for your events to be hit with your current setup you should also specify the controlId option. It should be the same as the name you’ve passed when adding the event handler in the global.asax file.
For example, if the event handler is added in the following way:
UploadProgressManager.Instance.AddStartingUploadEventHandler("upload1",
new EventHandler<UploadStartingEventArgs>(igUpload_UploadStarting));
The controlId should be also set to “upload1”:
$("#igProductUpload").igUpload({
mode: "single",
controlId: “upload1”
});
For details on the event handlers please refer to:
http://www.igniteui.com/help/igupload-using-server-side-events-
Also note that the actual handling of the upload is done via a HttModule, which should also be added in your web config file. Please refer to the following topic that covers the needed settings in the web.config:
http://www.igniteui.com/help/igupload-using-http-handler-and-modules
Note that the settings differ depending on the IIS version on which the web site will be hosted.
The fileUploadPath configuration you’ve defined in the appsettings specifies the path to the location where the uploaded files will be stored once they are uploaded. So with the current setup of:
“<add value="~/Uploads" key="fileUploadPath" />”
The file will be uploaded in a folder named “Uploads” located under the root directory of your application.
As a troubleshooting tip I suggest that you open the browser’s development tool’s Network and check whether the requests initiated by the igUpload are properly handled by the HttpModule. If there are any issues with it check the HttpModule’s settings in your web.config.
Let me know if you have any questions or concerns.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://www.infragistics.com/support
I've added the controlId to the JavaScript declaration. We never write any JavaScript in the view, it is all in a JavaScript file. We also do not use MVC Wrappers - it puts unnecessary processing on the server whereas a pure HTML + CSS + SCRIPTS are static and can be cached.
<modules runAllManagedModulesForAllRequests="true"> <add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule" preCondition="managedHandler" /> </modules>
I did omit the run all modules. If this is a required setting then we won't go with this control because that adds a performance impact to every request in the system.
With the inclusion of that, it now uploads on the server.
I am getting this error message on the server:
InternalExceptionFileStarting
But the file seems to be there. How do I troubleshoot this further?
Handler is returning this:
Request:
GET /Admin/IGUploadStatusHandler.ashx?key=T66Olfwe33MifBHushV9w1IbB3HTyV&command=status&_=1447448493253 HTTP/1.1
Response:
{"error":8,"serverMessage":"","size":14645535,"bytesUploaded":0,"status":1}
Random ASPX page is returning a 500:
POST /Admin/ig_fua34sf345sdf13sdf3454erdsf2345asd3425df5235d54df345.aspx?key=T66Olfwe33MifBHushV9w1IbB3HTyV&cid=igUpload&multiple=true HTTP/1.1
$.ced.ig.upload({ id: "igProductUpload", controlId: "igUpload", uploadUrl: $.ced.createUri("/ig_fua34sf345sdf13sdf3454erdsf2345asd3425df5235d54df345.aspx"), progressUrl: $.ced.createUri("/IGUploadStatusHandler.ashx"), mode: "single", fileuploading: function (e, ui) { alert("File Id: " + ui.fileId + "\r\n" + "File Path: " + ui.filePath + "\r\n" + "File Status: " + ui.fileStatus + "\r\n" + "Total Size: " + ui.totalSize + "\r\n" + "Uploaded Bytes: " + ui.uploadedBytes + "\r\n"); } });
The error message above was because of the deployment script wiped out my "Uploads" folder. I added one in the solution so Web Deploy would recreate on any future deployments. Now we receive this:
{"error":-1,"serverMessage":"","size":14645535,"bytesUploaded":14645535,"status":2}
Which translate too:
-1 - No Error2 - File Upload is Finished
Yay!
I’m glad to hear that you’ve been able to solve your issue. If you have any additional questions or concerns don’t hesitate to let me know.