Documentation > CMS Template API Library > PanelEntry > SaveUploadedFile(String,UploadedFile)
SaveUploadedFile
Save an uploaded file with the given key to the panel in the context of the backing asset or current asset. Note: If this is in the PostInputContext and you go the panels from an InputForm, the data will be saved in the current asset. Note: Do not include the post fix ":..." part of the name. Use the shortname "my_field", not "my_field:1"
public System.Void SaveUploadedFile(String,UploadedFile)
Parameters
| Name | Description | Type |
|---|---|---|
| key | The key where we are going to save this file | System.String |
| uploadedFile | The UploadedFile object | CrownPeak.CMSAPI.UploadedFile |
Code Example
C#
Sample:
List<PanelEntry> panels = asset.GetPanels("panelName");
if (panels.Count > 0)
{
// Get the upload called "thumbnail" from the first panel
UploadedFile file = panels[0].UploadedFiles["thumbnail"];
if (file != null) // save another copy
panels[0].SaveUploadedFile("save_thumbnail", file);
}