Hello,
I am trying to use the filepickeruploader control.
I have it basically working, please see the code below which I modified from the DNN source code.
It adds a folder if one doesn't exist, allows a file to be selected and uploads it.
But I have some parameters (one of which is the moduleid) stored on the client which I'd like to associate with that file for further processing on the server.
Is there any way to do that? For example, If I could rename the uploaded file from say 'somefilename.png' to '[ModuleID]_somefilename.png', that would allow me to process the file server side.
The other possibility, would be to send the file to a more specific directory. For example:
SomeDirectoryPath/[ModuleID]/[SomeOtherField]
Again, the path would need to be set on the client side. I tried changing the filepickeruploader control to allow the path to be entered into the file path combobox directory, but that didn't work. presumably because the directory path isn't registered on the server side. But I don't want to have to enter every possible path on the server side.
Best Regards,
Steve
var userControl = Page.LoadControl("~/controls/filepickeruploader.ascx");
DotNetNuke.Web.UI.WebControls.DnnFilePickerUploader _fileControl
= userControl as DotNetNuke.Web.UI.WebControls.DnnFilePickerUploader;
string ImagePath = "DesktopModules/FlexiContent/images/";
DotNetNuke.Services.FileSystem.IFolderInfo f = DotNetNuke.Services.FileSystem.FolderManager.Instance.GetFolder(PortalId, ImagePath);
//DotNetNuke.Services.FileSystem.FolderManager.Instance.DeleteFolder(f);
f = DotNetNuke.Services.FileSystem.FolderManager.Instance.GetFolder(PortalId, ImagePath);
if (f == null)
{
DotNetNuke.Services.FileSystem.FolderManager.Instance.AddFolder(this.PortalId, ImagePath);
}
_fileControl.FolderPath = ImagePath;
_fileControl.FilePath = ImagePath;
//_fileControl.ID = thisTarget;
_fileControl.FileFilter = "jpg,jpeg,gif,png";
_fileControl.EnableViewState = true;
_fileControl.ViewStateMode = ViewStateMode.Enabled;
//_fileControl.UsePersonalFolder = false;
_fileControl.User = null;
FileUploadPlaceHolder.Controls.Add(_fileControl);