This is a migrated thread and some comments may be shown as answers.

Upload Progress Issue(Uploading to sharepoint)

3 Answers 360 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Gopal Gajjar
Top achievements
Rank 1
Gopal Gajjar asked on 21 May 2010, 04:14 PM
Hi,

I'm working with Silverlight RadUpload control to upload file to sharepoint

following is how my code look like.

//overriding base method to upload to sharepoint  
public override void ProcessStream()  
{  
   //getting file and extract some info.  
 
   //uploading file to sharepoint  
 
   //get uploaded file and update metadata  
 

here, I override the base method to add sharepoint logic.

The issue is , File is uploaded in sharepoint , but i'm not able to see upload progress, even after file is uploaded(i can see file in sharepoint ),  the progress is 0%. on control (or UI). the top lebel is changed to upload done.
Also the alert icon is showing next to file.

Im thinking there should be something in base method which communicates with control to and says file is upoaded.
(because, when i add base.processstream() progress is shown but, that also uploads in local folder.)
 

also. is there any way to upload file directly to sharepoint , without moving to local upload folder..
Any help will be appareciated..

thanks
G

3 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 27 May 2010, 09:08 AM
Hello Gopal Gajjar,

Thank you for contacting us.

Please note the ProcessStream method cares about the return parameters. If you override it you should send them back to the client. The easiest way is to call the base implementation and after that to deal with the uploaded file.

About the Sharepoint.
Till now it's not possible to store files in a SharePoint-database by chunks. This is a limitation of the Sharepoint API.

And finally please be aware with the latest release we changed a bit the upload protocol. Because of this we highly advise you to preview the Batch Upload article.

We hope this information will help you. However if you need further assistance just drop us a line.

Kind regards,
Ivan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Gopal Gajjar
Top achievements
Rank 1
answered on 27 May 2010, 05:17 PM
Hi Ivan,

I saw the article. can you please tell me more about default internal return parameters. what if im not sending any parameter. is base.processStream() required thing? if i comment base.processStream() then file is still uploaded but progress bar animation is not there.

thanks
G
0
Valentin.Stoychev
Telerik team
answered on 02 Jun 2010, 07:25 AM
Hi Gopal Gajjar,

Here is the source of the ProcessStream method you need:
public virtual void ProcessStream()
    {
        this.currentFileID = 0;
        for (int fileIndex = 0; fileIndex < this.Request.Files.Count; fileIndex++)
        {
            HttpPostedFile fileSource = this.Request.Files[fileIndex];
            this.currentFileID = fileIndex;
            Int32.TryParse(fileSource.FileName, out this.currentFileID);
            string fileName = this.GetFileName();
            string filePath = this.GetFilePath(fileName);
            this.AddReturnFileParam(RadUploadConstants.ParamNameFinalFileRequest, this.IsFinalFileRequest());
            long position = Convert.ToInt64(this.GetQueryParameter(RadUploadConstants.ParamNamePosition));
            bool success = false;
            try
            {
                if (this.InitializeChunkStorage(filePath))
                {
                    int contentLength = Math.Max(fileSource.ContentLength, (int)fileSource.InputStream.Length);
                    byte[] buffer = new byte[Math.Max(1, contentLength)];
                    contentLength = fileSource.InputStream.Read(buffer, 0, contentLength);
                    int savedBytes = 0;
                    success = this.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);
                }
            }
            catch (Exception e)
            {
                success = false;
                this.AddReturnFileParam(RadUploadConstants.ParamNameMessage, String.Format("Cannot save the file: [{0}]", e.Message));
            }
            this.SendFeedback(success, fileName, filePath);
        }
    }

I highlighted the lines which communicate and send return parameters to the client. Please let us know if you need more info to get your handler done.

All the best,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Upload
Asked by
Gopal Gajjar
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Gopal Gajjar
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Share this question
or