Renaming a File

Coordinator
Jun 21, 2008 at 10:09 PM
Edited Jun 21, 2008 at 10:13 PM
Please get the latest source or binaries and use the newly added event FileNameDetermening. Here is an example that adds "_UPL_" suffix to the uploaded file:

<%

@ Register TagPrefix="fjxau" Namespace="com.flajaxian.AWS" Assembly="com.flajaxian.AmazonUploader" %>
<%
@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader"%>
<% @ Import Namespace="System.IO" %>
<SCRIPT language="C#" runat="server">
protected
void FileNameDetermening(object sender, FileNameDetermeningEventArgs args)
{
       args.FileName =
Path.GetFileNameWithoutExtension(args.FileName) + "_UPL_" + Path.GetExtension(args.FileName);
}
</SCRIPT>

 

<fjx:FileUploader ID="FileUploader1" runat="server" >
    <Adapters>
        <fjxau:AmazonUploader
            AccessKey="WebConfig:AmazonAccessKey"
            SecretKey="WebConfig:AmazonSecretKey"
            BucketName="media.somedomain.com" 
            OnFileNameDetermening="FileNameDetermening" 
            Path="test/test2">
            <AccessControlList>
                <fjxau:AccessControl URI="http://acs.amazonaws.com/groups/global/AllUsers            Permission="READ" />
                <fjxau:AccessControl EmailAddress="john@smith.com" Permission="FULL_CONTROL" />
            </AccessControlList>
        </fjxau:AmazonUploader>
    </Adapters>
</fjx:FileUploader>