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

File information in code behind

1 Answer 50 Views
CloudUpload
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 27 Nov 2013, 02:52 PM
I'd like to lay out a scenario and hopefully someone can help me figure out the best want to implement either the Cloud or Async uploader to solve it. I am using Windows Azure web sites, storage and SQL.

Our business allows customers to upload medical bills to our site.  We then review those files for overcharges, billing errors, etc.  The uploaded file could be a single bill or a combination of bills all in one file.  After the file is uploaded, I need to capture information about the file as well as other user meta information into our database,

I love the ease at which the CloudUpload integrates with Azure.  My main question is, what is the best way to capture the information (mainly the keyname) for each file uploaded and insert that information into our database, along with session information identifying the user?

Right now, I have a button on the page to force a postback, but the postback removes the file upload progress and only seems to capture the last uploaded file.

One thing I want to prevent, is the user uploading files, not clicking the button and then having orphaned files in our storage.

Thanks,

Greg


1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 28 Nov 2013, 12:31 PM
Hi Greg,

There are a few approaches that you can use. One of them is to handle the client's OnClientFileUploaded event and call a web service, which stores file name into the database:
function OnClientFileUploaded(sender, args) {
    var fileInfo = args.get_fileInfo();
    var keyName = fileInfo.keyName;
    //call Web Service to store the file name into the database
}
You can keep the session information identifying the user in hidden field.

Other approach could be to handle OnFileUploaded event, which will be fired after you cause a postback. Note that after the postback this event will be fired for every of the uploaded file.
protected void RadCloudUpload1_FileUploaded(object sender, CloudFileUploadedEventArgs e)
{
    string keyName = e.FileInfo.KeyName;
      //Store keyName in db
}

Unfortunately at the moment there is no way to prevent automatically uploading. It will start once after a file is selected. You could add a validation, to decrease the chance for the users to upload incorrect files.

Regards,
Hristo Valyavicharski
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
CloudUpload
Asked by
Greg
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or