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.

two questions about ejUploadbox

Thread ID:

Created:

Updated:

Platform:

Replies:

117547 Nov 5,2014 09:35 PM May 2,2016 05:45 AM JavaScript 9
loading
Tags: ejUploadbox
Randy Craven
Asked On November 5, 2014 09:35 PM

Hello,

I would like to know if there are samples or information about how to do these two things with ejUploadbox.

  1. After the upload(s) are complete, change the text of the cancel button to "OK" or "Close". Since the upload is now complete, the button text should logically be something other than "Cancel".

  2. If there is an error, is it possible to present some detail about the error to the user?  I see that the error event returns the parameters: model, type, and files.  In the event of an error, e.type appears to just be the text "error".  Is there documentation about how to use the model and files parameters?

thanks,

Randy


Randy Craven
Replied On November 5, 2014 09:52 PM

I figured out how to do #1:

    $(function () {
        $("#UploadDefault").ejUploadbox({
            complete: "fileuploadcomplete",
            saveUrl: "../../saveFiles.ashx",
            removeUrl: "../../removeFiles.ashx"
        });
    });
    function fileuploadcomplete(e, ui) {
        $("#UploadDefault").ejUploadbox({ buttonText: { cancel: "OK" } });
    }



Randy Craven
Replied On November 5, 2014 10:00 PM

Here are some other things about ejUploadBox that would be good to know:

  • how to set the size of the "Browse" button?
  • how to set the position of the ejUploadBox within the browser window?
  • how to alert the user if they have selected a file with extension not in the "extensionsAllowed" list?

Thanks very much for any information about these items.

Randy


Randy Craven
Replied On November 5, 2014 10:59 PM

I would like to ask one more question about ejUploadBox:

How to pass additional parameters to an MVC controller when the file upload is complete?  For example, if a customer can upload a file, it might be desirable to pass the customer id to the controller action so that files from different customers could be segregated on the server.

Thanks!

Randy

Randy Craven
Replied On November 6, 2014 12:27 AM

answer to: How to pass additional parameters to an MVC controller when the file upload is complete?


    function fileuploadcomplete(args) {
        $.post('@Url.Action("Action", "Controller")', { fileName: args.files.name, customerID: '@Model.CustomerID' });
    }





Sasikala Nagarajan [Syncfusion]
Replied On November 6, 2014 10:41 PM

Hi Randy Craven,

Thanks for using Syncfusion components,

Query: Is it possible to present some detail about the error to the user?

In our ejUploadbox, we have provided the action argument in the error event. Action argument provide the cause of the error. Different values of the action argument in error event.

action – ExtensionAllow : If the error event triggered due to the user select the file other than the files that are listed in extensionAllow.

action – ExtensionDeny :  If the error event triggered due to the user select the files that are listed in ExtensionDeny.

action – Error : If the error event triggered due to the URL not found.

We didn’t provide the full details of error in the error event. We have consider this as an issue (“Need to give full information about error”). We have logged an issue report for this. Fix for this issue will be available in our next service pack release which is expected to be rolled out at the end of the next month. We will notify you once our service pack release is rolled out. If you want the fix sooner please let us know, so that we can provide you patch for this fix on or before (27th November).

Query: Is there documentation about how to use the model and files parameters

There is no separate documentation for how to use model, files arguments in the error event. Please find the below information to know more about files, model arguments.

In files argument we can get the following information.

1.      Extension of file (extension)

2.      Name of the file(name)

3.      File properties(rawfile)

a.       lastModified

b.      lastModifiedDate

c.       name

d.      size

e.       type

4.      Size

Please find the below code snippet, to know how to use files arguments

[javascript]

function errorhandling(args) {

           alert(args.files[0].name);

           alert(args.files[0].rawFile.lastModifiedDate);

 }

In model argument we can get our ejuploadbox API values like extensionsAllow, multiplefileSlect, cssClass etc.

Please find the below code snippet to access the model argument.

[javascript]

function errorhandling(args) {

           alert(args.model.multipleFilesSelection);

           alert(args.model.buttonText);

 }

 

Queries:  how to set the size of the "Browse" button? How to set the position of the ejUploadBox within the browser window?

Sorry for the inconvenience caused. We didn’t provide any specific options for changing size and position of the upload box browse button. We have consider this as issue (“There is no option to change the size and position of the upload box”). We have logged an issue report for this. Fix for this issue will be available in our next service pack release which is expected to be rolled out at the end of the next month. We will notify you once our service pack release is rolled out. If you want the fix sooner please let us know, so that we can provide you patch for this fix on or before (27th November).

Query: how to alert the user if they have selected a file with extension not in the "extensionsAllowed" list?

We have analyzed your requirement. We can achieve your requirement using error event .We have prepared the sample based on your requirement and you can download this sample under the following location:

Sample: Uploadbox with Size

Regards,

Sasikala Nagarjan


Randy Craven
Replied On November 9, 2014 04:47 PM

Hello Sasikala,

Thank you for your reply and this information.  It is very useful.  It's not necessary to send a patch, just please let me know when the service release is available.

I would like to ask one more question:  Is it possible to get the name of the upload box div itself from the arguments passed to the complete event?  Something like the code below:

<div id="UploadDefault"></div>
<script>
    $(function(){
            $("#UploadDefault").ejUploadbox({
                complete: "onComplete"
            });
    });
    function onComplete(args){
       
        // retrieve the div name 'UploadDefault' from arguments

    }
</script>


Thank you again,
Randy


Sasikala Nagarajan [Syncfusion]
Replied On November 10, 2014 08:11 AM

Hi Randy Craven,

Thanks for the update.

We have analyzed your reported scenario. There is no arguments are passed to get the “id” of the upload box in the “complete” event. To get the id of the upload box’s div, please find the below code snippet.

function onComplete(args)

      {

       alert(“ID of the uploadbox”+ this.element[0].id);

      }

In above code snippet this.element[0].id” returns the id of the uploadbox’s div.

Also, our next service pack release is expected to be rolled out at the end of the November month

Please let us know if you need any further assistance.

Regards,

Sasikala Nagarajan


Jitender Kumar
Replied On April 29, 2016 03:21 AM

Hi Sasikala Nagarajan,

I have a problem with both jquery syncfusion UploadBox $("#divUploadBox").ejUploadBox({...}) and MVC Upload box @Html.EJ().UploadBox("MyUploadBoxId"). These controls are working fine on local system while running from Visulal Studio. But these are not working on IIS Server as the Action and Controller path given in the  saveURL (saveURL: "/ControllerName/SaveDefault") is not detecting on IIS .
Please suggest what should be done to resolve this on IIS.

Thanks & Regards,
Jitender 




Muralishankar Sundaram [Syncfusion]
Replied On May 2, 2016 05:45 AM

Hi Jitender,    
  
Thanks for your update,    
  
In order to handle the reported issue -“ these are not working on IIS Server as the Action and Controller path given in the  saveURL (saveURL: "/ControllerName/SaveDefault") is not detecting on IIS.” we suggest you to use @Url.Action URL helper, which will form the action URL based on the application configuration. Please find the sample snippet below:   
 
[View- CSHTML] 
 
<code> 
 
@Html.EJ().Uploadbox("UploadDefault").SaveUrl(@Url.Action("SaveActionName","ControllerName")).RemoveUrl(@Url.Action("RemoveActionName ","ControllerName")) 
 
</code> 

We have prepared the simple uploadbox sample with the use case scenario and refer the below link:   http://www.syncfusion.com/downloads/support/forum/117547/ze/WebApp-1253510022  

Please let us know if you have any other concerns. 

Regards, 
Muralishankar 


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.

;