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

Notification

Icon
Error

Options
Go to last post Go to first unread
sweetjos  
#1 Posted : Sunday, September 25, 2011 9:59:01 PM(UTC)
sweetjos

Rank: Newbie

Groups: Member
Joined: 9/25/2011(UTC)
Posts: 2

Thanks: 1 times
I am trying to upload a file. That original file should be stored in one folder and converting that file into 2 sizes 100 x 100 and 266 x 169 . These 2 should be saved in 2 different locations.

how is this possible.

I am using Asp.Net 2.0 C#



Regards

Joshua
Dmitry.Obukhov  
#2 Posted : Sunday, September 25, 2011 10:15:03 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

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

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

You should specify two folders: first one is for source files, another one is for thumbnails. Then save uploaded files and thumbnails through SaveAs method, like in this code snippet:
Code:
string galleryPath = Server.MapPath("Gallery/");
string thumbnailsPath = galleryPath + "Thumbnails/";
//Save original file.
//It is the first file in ConvertedFiles collection as we set first converter mode to SourceFile.
string sourceFileName = GetSafeFileName(galleryPath, e.UploadedFile.SourceName);
e.UploadedFile.ConvertedFiles[0].SaveAs(System.IO.Path.Combine(galleryPath, sourceFileName));

//Save thumbnail 1.
//It is the second file in ConvertedFiles collection as we set second converter mode to Thumbnail.
string thumbnailFileName1 = "thumb1_" + e.UploadedFile.SourceName;
e.UploadedFile.ConvertedFiles[1].SaveAs(System.IO.Path.Combine(thumbnailsPath, thumbnailFileName1));

//Save thumbnail 2.
//It is the second file in ConvertedFiles collection as we set second converter mode to Thumbnail.
string thumbnailFileName2 = "thumb2_" + e.UploadedFile.SourceName;
e.UploadedFile.ConvertedFiles[2].SaveAs(System.IO.Path.Combine(thumbnailsPath, thumbnailFileName2));

If you have any additional questions please feel free to let me know.

Edited by user Sunday, September 25, 2011 11:20:56 PM(UTC)  | Reason: Not specified

Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
thanks 1 user thanked Dmitry.Obukhov for this useful post.
sweetjos on 9/25/2011(UTC)
sweetjos  
#3 Posted : Sunday, September 25, 2011 10:49:42 PM(UTC)
sweetjos

Rank: Newbie

Groups: Member
Joined: 9/25/2011(UTC)
Posts: 2

Thanks: 1 times
Thanks for reply and it works fine...


Regards

Joshua
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.