Welcome Guest! You need to login or register to make posts.



Go to last post Go to first unread
#1 Posted : Sunday, February 26, 2012 5:06:16 AM(UTC)

Rank: Newbie

Groups: Member
Joined: 2/25/2012(UTC)
Posts: 1

Hi. I am evaluating this great product, but I have one major problem. The uploaded file is saved in the name of the original file name appended to _Thumbnail01.jpg. I don't want this behaviour. I would like to name the uploaded file as something like "Session variable"_01.jpg with the session variable being something like Property1 etc. I have read posts on this forum where you say simply do this on the server. Yes, but how?
Do I rename the files after saving, or can I amend thumbnailFile.Name. This seems to be buried in the source code. It will allow me to append to thumbnailFile.Name but not remove items from it.

Can this be done?


EDIT: Sorry, should have mentioned this problem is specific to the Resize feature where the process iterates through three processess of the same image. For example if you replace thumbnailFile.Name with "Whatever" and upload more then one image, it causes all the uploads to be renamed Whatever_etc.

Edited by user Sunday, February 26, 2012 5:16:09 AM(UTC)  | Reason: more information

#2 Posted : Monday, February 27, 2012 2:41:14 AM(UTC)

Rank: Advanced Member

Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Hello James,

You can save converters with any names you need. As far as I understand you evaluate ResizedPhotoUploadDemo sample (Image Uploader ASP.NET). Here is the code illustrating how to rename converters on server side:

// My session variable
string str = Session["Aurigma"].ToString();
// Get index of package to set it as suffix in file name (_0, _1, etc.)
int count = e.UploadedFile.Package.PackageIndex;
// Image Uploader configured to upload 3 thumbnails for every selected to upload file
int thumbnailCount = 3;
string[] thumbnails = new string[thumbnailCount];
// Save thumbnails
for (int i = 0; i < thumbnailCount; i++)
  ConvertedFile thumbnailFile = uploadedFile.ConvertedFiles[i];
  if (thumbnailFile != null)
    //string thumbnailName = Utils.GetSafeFileName(gallery.ThumbnailsAbsolutePath, thumbnailFile.Name);
    //File name looks like Session_i_n.jpg, where i is converter index, but n is file (package) index 
    string thumbnailName = str + "_" + i + "_" + count + ".jpg";
    thumbnailFile.SaveAs(Path.Combine(gallery.ThumbnailsAbsolutePath, thumbnailName));
    thumbnails[i] = thumbnailName;

If you have any additional questions, please feel free to let me know.
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
Users browsing this topic
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.