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

Upload doesn't work in production environment

1 Answer 123 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Helge
Top achievements
Rank 1
Helge asked on 03 Jan 2012, 11:03 AM
Hi,

I have created an Silverlight app that implements the RadUpload component by following Sahil Malik's video (http://blah.winsmarts.com/2010-3-Large_File_Upload_in_SharePoint_2010.aspx). The upload path is to the SharePoint 14-hive (a custom folder) and is handled by a custom HttpHandler. This works just fine on my dev server (VMWare image), but when I deploy this to my client's prod server, I get the following error:
"Cannot save the file: [Access to the path 'c:\program files\common files\microsoft shared\web server extenstions\14\template\layouts\<my project name>\Scratcharea\<my file name>' is denied]"
The error message is shown as a tooltip on a little 'alert' icon to the right of the selected file to upload.

I haven't done anything in regards to setting permissions to the destination folder in either environment.

PS. The Silverlight app is hosted in SharePoint 2010.

Any ideas?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 06 Jan 2012, 10:57 AM
Hi Helge,

This video is using an old version of the RadUpload control and this is why you might have to reconsider some of its logic. With the last version of the control one upload request (i.e. one chunk) can contain multiple files and this means that there were some changes introduced in the RadUploadHandler implementation. More info you can find here.  Basically now instead of using this syntax - this.Request.Form[key]; to get the name of the file it is recommended to get it through the GetFileName() method of the RadUploadHandler.

Also with the latest version of the RadUpload control it is better to modify the UploadHandler by overriding the SaveChunkDate() method instead of the ProcessStream() method, thus writing the following UploadHandler implementation:
public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)
{
    bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);
    if(this.IsFinalFileRequest())
    {
        SPContext.Current.Web.AllowUnsafeUpdates = true;
        FileStream fStream = new FileStream(filePath, FileMode.Open);
        SPContext.Current.Web.Files.Add("/BigFiles/"+ this.GetFileName(), fStream, true);
        fStream.Close();
        File.Delete(filePath);
    }
}

Please make the above modifications and test your code again as they can help.

Also, it is important to check if the SharePoint user has the proper rights for creating files under the Scratcharea folder as if the user can't access the folder, then the RadUpload control won't be able to access it as well and the uploaded files won't be saved thus causing the "Cannot save the file" error message.

I hope this information will help you.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Upload
Asked by
Helge
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or