We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

UploadBox - how to send a custom statut code to OnComplete callback function ?

Thread ID:

Created:

Updated:

Platform:

Replies:

107769 Mar 15,2013 09:38 AM Mar 19,2013 06:36 AM ASP.NET MVC (Classic) 1
loading
Tags: Tools
Jacques Duclos
Asked On March 15, 2013 09:38 AM

Hello,
 
How to send a custom statut code (action controller) to OnComplete callback function ?
 
Moreover, how can I check file size prior uploading it (by property max file size) ?
 
Thanks,
 
Jacques Duclos

Varalakshmi R.S [Syncfusion]
Replied On March 19, 2013 06:36 AM

Hi Jacques Duclos,

 

Thanks for contacting Syncfusion forums.

 

Query 1:

You can send the custom status to controller by triggering ajax post on upload complete event. Please refer the below given code snippet,

<code>

[View]

@{Html.Syncfusion().UploadBox("upload")

 

    .AsyncUpload(

        a =>

            a.SaveAction("Save", "Home")

            .RemoveAction("Remove", "Home")

 

         ).ClientSideOnComplete("ClientSideOnComplete").ClientSideOnSelect("ClientSideOnSelect").Render();}

[Script]

 

function ClientSideOnComplete(sender, args) {

//Pass status as arguments in data

        $.ajax({

            type: "post",

            url: "Home/Index",

            data: { "args": "Custom Status" },

            dataType: 'html',

            success: function (data) {

 

            }

 

        });

    }

 [Controller]

[HttpPost]

        public ActionResult Index(string args)

        {

//args hold the value sent from script

            return View();

        }

 

</code>

Query 2:

The size of the file can be retrieved in the event “ClientSideOnSelect” from its argument “args[0].size”. please refer the below given code snippet,

<code>

[Script]

function ClientSideOnSelect(sender, args) {

        alert(args[0].size);

    }

</code>

Note : To retrieve the file size in IE, you must enable the ActiveXcontrols using the below given option,

Tools->IE options-> Security->Trusted Sites->Custom level->Initialize and script ActiveX controls not marked as safefor scripting->Enable.

 

Kindly try the above solutions and let us know if this helps.

 

Regards,

Varalakshmi

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;