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

Notification

Icon
Error

Options
Go to last post Go to first unread
suve8481  
#1 Posted : Thursday, September 30, 2010 6:52:30 PM(UTC)
suve8481

Rank: Newbie

Groups: Member
Joined: 9/30/2010(UTC)
Posts: 3

I am trying to use Flash uploader in MVC ih have

Code:
<configuration>
   <system.web>
        <httpModules>
            <add name="UploaderModule" type="Aurigma.Uploader.UploaderModule"/>
        </httpModules>
   </system.web>
   <system.webServer>
        <modules>
            <add name="UploaderModule" type="Aurigma.Uploader.UploaderModule"/>
        </modules>
   </system.webServer>
</configuration>

in my web.config and placed the following code in my controller

Code:
        public void UploadImages(System.Object sender, System.EventArgs e)
        {
            var album = Session["albumName"].ToString();
            var galleryId = Guid.Empty;
            //int i = 0;
            int fileCount = int.Parse(Request[PostFields.PackageCount]);
           // string galleryPath = HttpContext.Server.MapPath("../Content/Images/Uploaded/");
            //file.SaveAs(imagesDir + image.ImageId);
            //string galleryPath = "/Uploaded";
            for (int i = 0; i < fileCount; i++)
            {
                string originalFileName = Request[string.Format(PostFields.SourceName, i)];

                // save original file
                string physGalleryPath = Server.MapPath("../Content/Images/Uploaded/");
                string sourceFileName = originalFileName;
                if (Request.Files[string.Format(PostFields.File, 0, i)] != null)
                {
                    Request.Files[string.Format(PostFields.File, 0, i)].SaveAs(System.IO.Path.Combine(physGalleryPath, sourceFileName));
                }

                // save thumbnail
                string physThumbnailsPath = Server.MapPath("../Content/Images/Uploaded/" + "Thumbnails/");
                string thumbnailFileName = originalFileName;
                if (Request.Files[string.Format(PostFields.File, 1, i)] != null)
                {
                    Request.Files[string.Format(PostFields.File, 1, i)].SaveAs(System.IO.Path.Combine(physThumbnailsPath, thumbnailFileName));
                }

                ////Save file info.
                //var descriptions = new XmlDocument();
                //descriptions.Load(Server.MapPath(galleryPath + "Descriptions.xml"));

                //XmlElement file = descriptions.CreateElement("file");
                //file.SetAttribute("name", sourceFileName);
                //file.SetAttribute("thumbName", thumbnailFileName);
                //file.SetAttribute("width", Request[string.Format(PostFields.SourceWidth, i)]);
                //file.SetAttribute("height", Request[string.Format(PostFields.SourceHeight, i)]);
                //file.SetAttribute("description", Request[string.Format(PostFields.Description, i)]);

                //if (descriptions.DocumentElement != null)
                //{
                //    descriptions.DocumentElement.AppendChild(file);
                //}

                ////Save xml file with uploaded files info.
                //descriptions.Save(Server.MapPath(galleryPath + "Descriptions.xml"));
            }

but only first file is getting saved and getting stuck

Please help

Edited by moderator Monday, December 6, 2010 4:53:30 AM(UTC)  | Reason: Not specified

Dmitry.Obukhov  
#2 Posted : Thursday, September 30, 2010 7:57:34 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,

Image Uploader Flash sends a one file per package.

It seems that you use InitGallery() method where new uploaded files are deleted. Therefore you get the last file from the last package.

Please comment the string like in this code snippet:

Code:

//Delete source files
        DirectoryInfo dir = new DirectoryInfo(Server.MapPath(galleryPath));
        foreach (System.IO.FileInfo file in dir.GetFiles())
        {
            //file.Delete();
        }
Best regards,

Dmitry Obukhov

Technical Support. Aurigma, Inc.

suve8481  
#3 Posted : Thursday, September 30, 2010 10:50:12 PM(UTC)
suve8481

Rank: Newbie

Groups: Member
Joined: 9/30/2010(UTC)
Posts: 3

HI Dmitry,

I am not using InitGallery() method anywhere

my view has just the code for showing the flash uploader.....upload actionrl i have set to ControllerAction

Please help with some examples where you guys have used flash in MVC architecture its very urgent

Thanks in advance

Venkat

Dmitry.Obukhov wrote:
Hello,

Image Uploader Flash sends a one file per package.

It seems that you use InitGallery() method where new uploaded files are deleted. Therefore you get the last file from the last package.

Please comment the string like in this code snippet:

Code:

//Delete source files
        DirectoryInfo dir = new DirectoryInfo(Server.MapPath(galleryPath));
        foreach (System.IO.FileInfo file in dir.GetFiles())
        {
            //file.Delete();
        }
Dmitry.Obukhov  
#4 Posted : Sunday, October 3, 2010 12:31:22 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 Venkat,

We have example, which shows how to integrate standard Image Uploader with ASP.NET MVC. Please read the forum post HOWTO: Using Image Uploader with ASP.NET MVC. I think it will be hopeful to implement the same way for Image Uploader Flash.

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

Edited by user Sunday, October 3, 2010 12:32:18 PM(UTC)  | Reason: Not specified

Best regards,

Dmitry Obukhov

Technical Support. Aurigma, Inc.

Users browsing this topic
Guest
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.