Im having a bit of a problem when two or more users are uploading files at the same time. The uploads seems to be mixed up on the server.
Im trying to do this by reading the UrlReferer for each incoming request.
internal static void HandlerUploadFinising(object sender, UploadFinishingEventArgs args) {
var uploadId = Convert.ToInt32(System.Web.HttpContext.Current.Request.UrlReferrer.Segments.Last());
internal static void HandlerUploadFinished(object sender, UploadFinishingEventArgs args) {
This does not work when two users are uploading at the same time.
Is there any way of sending parameters to the server for each upload. I need to send a unique user id from the the client to the server to ensure that the upload is saved to the correct user.
Hi,
Thank you for posting in Infragistics forums! Last Service Release we added a new functionality that helps you implement this scenario very easy. The first thing is to handle onFormDataSubmit event and then call addDataField method to add the information you want to send to the server. The code looks like something like this:
$("#upload1").on("iguploadonformdatasubmit", function (evt, ui) { $("#upload1").igUpload("addDataField", ui.formData, { "name": "Parameter Name", "value": "Value" }); });
The second thing is to get the sent information on the server side. Every server side event argument has an extra property called AdditionalDataFields which holds the information in “Name-Value” format. The code looks like this:
public static void igUpload_UploadStarting(object sender, Infragistics.Web.Mvc.UploadStartingEventArgs e){ foreach (var dataField in e.AdditionalDataFields) { string fieldName = dataField.Name; string fieldValue = dataField.Value; } }
I hope this helps!
Kind regards, Petko Zhekov Software Developer
Excellent! That was exactly what i was looking for? Is there any updated documentation for this?
Since this functionality was added in a service release the corresponding information about it is not yet added to the official documentation. It will be added in future release or rerelease of the Help.
Since then I’m available for any questions you have about it!
Kind regards,
Petko Zhekov
Software Developer
What service release is this in? Will this work with the MVC helper version of the upload Infragistics.Web.MVC.
We are having a problem with concurrency and I think this may fix it. Inside of the FileUploadingEvent we take the file stream and pass it with some other parameters to a file storage API. Somehow the stream and parameters are getting mixed because it has to get the additional parameters from outside of the event handler method. When multiple user are uploading there is not way to make sure upload info outside of the FileUploadingEvent matches the file inside. I think if the additional parameters were pass along with the uploading event it would solve this issue we have with multiple users uploading.
I am not able to get the e.AdditionalDataFields to resolve in Visual Studio I am using Infragistics.Web.Mvc version 5.15.1.1005.
I was able to get the correct update and I have it working great feature. I want to use this to send a json string to the event handle what is the size limit of the value.