Rank: Newbie
Groups: Member
Joined: 2/11/2010(UTC) Posts: 4
|
how do i add a unique identifier for the files i uploaded with S3 in C#? It currently uses $.filename, BUT what control where i can do something where i give it a unique GUID for each file when it loops through the files.
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hello, You can add unique name for each file using the following code: Code:var iu = new ImageUploaderWriter("ImageUploader1", 650, 400);
// other params...
iu.addEventListener("PackageBeforeUpload", "packagebeforeupload");
// other params...
iu.writeHtml();
function packagebeforeupload(packageIndex){
//get image uploader
var u = getImageUploader("ImageUploader1");
//get uploaded file name
var sourceName = u.getUploadFileName(1);
//get timestamp
//we save timestamp value to array to use the same value for original file and its thumbnails
timestamps['' + sourceName] = timestamps['' + sourceName] || +new Date; // use saved value or create new
//get extension
var ext = sourceName.split(".");
ext = ext[ext.length - 1];
//get name
var name = sourceName.split(".");
name.length--;
name = name.join('.');
//manual add filed with filename value
u.addField("key", folder + name + '_' + timestamps[sourceName] + '.' + ext);
}
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.