wondering if any one knows how to rename files before uploading to server directory?
Hello Infra_Jag,
Thank you for posting your question to Infragistics forums.
I suggest you to go throught the following forum post where our developer Angel explained how to rename the uploaded files.
http://blogs.infragistics.com/forums/p/60533/346765.aspx
Please let me know if you have any further questions regarding this matter.
Do you have any sample? will be great...
Hello David,
Thank you for your patience while I have been working on this issue.
You can change the uploaded filename using the following code.
Markup:
<ig:WebUpload ID="webUpload1" runat="server" AutoStartUpload="false" onuploadfinished="WebUpload1_UploadFinished" > </ig:WebUpload>
AutoStartUpload="false" onuploadfinished="WebUpload1_UploadFinished" >
</ig:WebUpload>
Codebehind
protected void WebUpload1_UploadFinished(object sender, Infragistics.Web.UI.EditorControls.UploadFinishedEventArgs e) { string ext = Path.GetExtension(e.FileName); string filePath = String.Format("{0}{1}", e.FolderPath, e.FileName); targetpath = targetpath + "" + "uploads"; System.IO.File.Copy(filePath, targetpath + "\\" +"test"+"."+ext, true); System.IO.File.Delete(filePath); }
{
string ext = Path.GetExtension(e.FileName);
string filePath = String.Format("{0}{1}", e.FolderPath, e.FileName);
targetpath = targetpath + "" + "uploads";
System.IO.File.Copy(filePath, targetpath + "\\" +"test"+"."+ext, true);
System.IO.File.Delete(filePath);
}
Hi Prabha,
Thanks it works perfectly..
Cheers
Jag