how to pass additional data with file uploading ?

Hello!
How can i pass additional data to controller with file uploading? And how can i get additional data back from controller?


7 Replies

NP Narayanasamy Panneer Selvam Syncfusion Team April 25, 2018 01:49 PM UTC

Hi Alex, 
 
Thanks for using Syncfusion products.  
 
We have validated your queries and prepared a sample based on your requirement. We can pass additional data to controller using argument of “uploading event, and get the same additional data through HTTP request in controller end.  
 
Code example: 
Controller File: 
 
public void Save() 
{ 
. 
. 
var valueFromClient = System.Web.HttpContext.Current.Request.Form.AllKeys[0]; 
var ObtainedValue = System.Web.HttpContext.Current.Request.Form[valueFromClient]; 
. 
. 
              
  // Sending the value to client side 
  Response.StatusDescription = new JavaScriptSerializer().Serialize(ObtainedValue);  
   } 
} 
 
Script File: 
    function OnUploading(args) { 
        var newdata1 = []; 
        newdata1.push({ name:"AAA"}); 
        args.customFormData = newdata1; 
    } 
    function OnSuccess(args) { 
 
     console.log("value retured from server is :" + args.e.currentTarget.statusText); 
 
    } 
 
Steps to run the sample: 
  1. Run the handler and wait until it launched successfully.
  2. After that run the shared sample.
 
Please look the sample and get back to us whether sample meet your requirement. 
 
Regards, 
Narayanasamy P.


AL Alex April 27, 2018 09:48 AM UTC

Thank you very mach.
I have some more questions.
1. How can i pass additional data to controller on deleting file? 
2. There is no information on server side (in controller) about file when i'm trying to delete preloaded files
Thx!!


NP Narayanasamy Panneer Selvam Syncfusion Team April 30, 2018 01:00 PM UTC

Hi Alex, 
  
Sorry for the inconvenience caused. 
  
We have validated your queries and we were able to reproduce the reported issue. The problem with “passing additional data to controller on deleting file” is already known issue in our end. Internally, we have fixed this and this fix will be available in our upcoming patch release which is expected to be roll-out on May first week. 
 
Regards, 
Narayanasamy P. 



AL Alex May 22, 2018 07:52 AM UTC

Hi!
Unfortunately, passing additional parameters  using argument of “uploading event  no longer works with release 16.1.0.42


KR Karthik Ravichandran Syncfusion Team May 23, 2018 02:19 PM UTC

Hi Alex, 
 
 
We have ensured the query “additional parameters on uploading event” with specified version. The additional parameters can be passed from uploading event, and can be received from server-end. We suspect that the reported issue may occurs due to latest packages are not downloaded properly into application.  

Please download the latest packages from below link. 

npm packages: 
 
 
CDN link:                  
 
 
For your convenience, we have modified the previously provided sample and attached in the below link. 
 
 
Note: “Additional parameters option on uploading event” is available from 16.1.38 release. 
 
If you still facing the same problem, could you please share the following details? 

  1. Confirm whether the feature works previously in your application?
  2. Share package.json file and configuration file.
 
This will help us to provide the solution at earliest. 

Regards, 
Karthik R 



AL Alex May 24, 2018 07:03 AM UTC

Hi, Karthik.
Thanks for your quick reply.
I'm sorry, but I do not exactly describe the problem. It works for one parameter, but not for a few.
Passing several parameters works fine with 16.1.0.37


KR Karthik Ravichandran Syncfusion Team May 25, 2018 01:31 PM UTC

Hi Alex, 
 
Sorry for the inconvenience caused. 
 
We can reproduce the reported issue when passing multiple parameters with 16.1.42 version. We have confirmed this as a bug in our side and fix for this issue will be included in our upcoming main release for volume 2, 2018 which is expected to be rolled out in the first week of June 2018. 
 
Regards, 
Karthik R 


Loader.
Up arrow icon