Hi,
I have renamed a image that has been uploaded using FileNameDetermining...
Then I launched the javascript FileStateChanged to show the image that has been uploaded to the user.....
Is this possible? Because the javascript's file.name actually takes the actual filename and not the renamed filename.. how could I use the renamed filename in the javascript?
This is what I did:
<script type="text/javascript" charset="utf-8">
function FileStateChanged(uploader, file, httpStatus, isLast) {
Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
var t = Flajaxian.$("uploadInfo");
if (file.state > Flajaxian.File_Uploading) {
t.innerHTML = "bytes:" + file.bytes + " name:" + file.name + "</br></br>"
+ "<img id='imgUpload' alt='Image Uploaded' src='assets/imgUpload/" + file.name +"' />";
}
//file name overwrite and filelist appearance
}
</script>
<script type="text/javascript" charset="utf-8">
function FileStateChanged(uploader, file, httpStatus, isLast) {
Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
var t = Flajaxian.$("uploadInfo");
if (file.state > Flajaxian.File_Uploading) {
t.innerHTML = "bytes:" + file.bytes + " name:" + file.name + "</br></br>"
+ "<img id='imgUpload' alt='Image Uploaded' src='assets/imgUpload/" + file.name +"' />";
}
}
</script>
<script runat="server">
protected void FileNameDetermining(object sender, FileNameDeterminingEventArgs args)
{
args.FileName = args.FileName.Insert(args.FileName.LastIndexOf("imgUpload\\") + 10, DateTime.Now.ToString("ddMMyyyy_HHmmss____")); //name not path and name
}
</script>
<fjx:FileUploader ID="FileUploader1" CssUrl="assets/css/fu.css" MaxFileSize="2MB"
TransparentBackground="False" IsSingleFileMode="true"
MaxFileSizeReachedMessage="No files bigger than {0} are allowed"
AllowedFileTypes="Web Images (Jpeg, Gif, Png):*.jpg;*.jpeg;*.png;*.gif"
UseInsideUpdatePanel="true" JsFunc_FileStateChanged="FileStateChanged"
MaxNumberFiles="1" MaxFileNumberReachedMessage="You are only allowed to upload {0} file."
MaxFileQueueSize="3MB" MaxFileQueueSizeReachedMessage="The images cannot be larger than than {0}"
runat="server" >
<Adapters>
<fjx:FileSaverAdapter Runat="server" FolderName="assets/imgUpload"
OnFileNameDetermining="FileNameDetermining" />
</Adapters>
</fjx:FileUploader>