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. Image for the cookie policy date
close icon

Send notifications to client while uploading file

Hi,

I want upload a file and process this file into server-side, but I want notify at client the different status while server process the file.

But all my notifications appear after the process ends, not during the process.

My code-behind:

        protected void ubImportacionOperaciones_Complete(object sender, Syncfusion.JavaScript.Web.UploadBoxCompleteEventArgs e)
        {
            ProcesarFichero(e.Name);
        }

        private void ProcesarFichero(string fichero)
        {
            try
            {
                AñadirLog(String.Format("Fichero: {0} subido correctamente", fichero));
                string file = HttpContext.Current.Server.MapPath("uploadfiles") + "\\" + fichero;
                string rutaDestino = HttpContext.Current.Server.MapPath("uploadfiles") + "\\" + Path.GetFileNameWithoutExtension(fichero) + "\\Decompress";

                if (Directory.Exists(rutaDestino))
                    Directory.Delete(rutaDestino, true);

                AñadirLog(String.Format("Fichero: {0} descomprimido", fichero));
                ZipFile.ExtractToDirectory(file, rutaDestino);

                foreach (string fileCSV in Directory.GetFiles(rutaDestino, "*.csv"))
                {
                    ImportarFichero(fileCSV);
                }
            }
            catch(Exception ex)
            {
                AñadirLog(ex.Message);
            }

        }

        private void AñadirLog(string mensaje)
        {
            var item = new ListBoxItems();
            item.Text = String.Format("{0} -> {1}", DateTime.Today.ToString(), mensaje);
            lbLog.Items.Add(item);
        }

Thanks

7 Replies

KC Kasithangam C Syncfusion Team September 25, 2015 08:39 AM UTC

Hi Manolo,

While upload a file in uploadbox, we can notify the status of the uploading files in client side by using our client side events. We have a documentation link for Uploadbox client side events and please go through the following API link:

http://help.syncfusion.com/js/api/ejuploadbox#events

We have prepared the sample based on this and please refer to the following location:

Sample: Sample

Could you please check the above sample whether its meets your requirement? Please let us know if you have further query.  

Regards,

Kasithangam



MA Manolo September 25, 2015 09:47 AM UTC

Hi,

I've modofy your example with my problem.

I want to do a post-process in event "OnComplete" and notify the different status at client.

I've use a ListBox but I can use other control if it is necessary.

In my example, I notify all actions when the event "OnComplete" finish, not during "OnComplete"

Attachment: SampleButton_a3f8322f.zip


KC Kasithangam C Syncfusion Team September 28, 2015 12:41 PM UTC

Hi Manolo,

In our uploadbox, “OnComplete” server side event triggers when the file upload is completed.So we can’t able to notify the processing uploaded file information in client side through the OnComplete event.We can display the processing uploaded file information in client side by using the “inprogress” client side event.Can you please confirm on whether you are expecting to display the uploading file each step by step process (Begin, uploading data in %, complete) in client side.The provided information would be helpful for us to serve you.

Please let us know if you have any query.

Regards,

Kasithangam



MA Manolo September 30, 2015 06:57 PM UTC

Hi again,

I solve this problem showing a waiting pop up.

But I've another problem...

After upload a file, I want that user can download a log file with results of to process the upload file. I can do it, but after download the file I can't upload other file.

In the example, I upload a file, after a button is showd to download a log file. After download this log, I can't upload other file.

Thanks

Attachment: SampleButton_6966fb74.zip


KC Kasithangam C Syncfusion Team October 1, 2015 03:54 PM UTC

Hi Manolo,

We are able to reproduce the issue “After download log file,while upload another file OnComplete server side event doesn’t triggers ”.Currently we are analyzing on this issue.So we need two business days (5th October,2015) to validate more on this and update the details.

Please let us know if you have further query.

Regards,

Kasithangam



MA Manolo October 2, 2015 07:30 AM UTC

Ok, no problem

Thank you very much


KC Kasithangam C Syncfusion Team October 6, 2015 04:24 AM UTC

Hi Manolo,

Currently we don’t have the support to achieve this behavior, and we have logged defect report for your requirement”After download log file, can’t able to upload another file and OnComplete server side event doesn’t triggers”. A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents 

Please let us know if you have further concern.


Regards,

Kasithangam


Loader.
Live Chat Icon For mobile
Up arrow icon