title: MVC3 uploadify uploading images to folders
body: <p>I am using uploadify for uploading multiple images with progress in ASP.NET MVC3 and I want to upload lets say from url Gallery/Upload/2 to folder with name 2 and Gallery/Upload/3 to folder 3 and so on. I just don´t know how. For get working uploading I used this <a href="http://midnightprogrammer.net/post/Upload-Files-In-RAZOR-With-jQuery-Uploadify-Plugin.aspx" rel="nofollow">sample</a> and modified sample upload script to this:</p>
  
  <pre><code>public string Upload(HttpPostedFileBase fileData)
          {
              var id = 2;
              var fotka = new Photo();
              fotka.GalleryId = id;
              fotka.Description = fileData.FileName;
              fotka.Name = fileData.FileName;
              db.Photos.Add(fotka);
              db.SaveChanges();
              var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileData.FileName);
              var fileName = Path.GetFileName(fileData.FileName);
              string path = Server.MapPath("~/Fotky/") + id.ToString() + "\\" + fileNameWithoutExtension;
              // var path = Path.Combine(Server.MapPath("~/Fotky/"), galleryId.ToString(), "/", fileNameWithoutExtension);
              using (var input = new Bitmap(fileData.InputStream))
              {
                  int width;
                  int height;
                  if (input.Width &gt; input.Height)
                  {
                      width = 128;
                      height = 128 * input.Height / input.Width;
                  }
                  else
                  {
                      height = 128;
                      width = 128 * input.Width / input.Height;
                  }
                  using (var thumb = new Bitmap(width, height))
                  using (var graphic = Graphics.FromImage(thumb))
                  {
                      graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                      graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                      graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
  
                      graphic.DrawImage(input, 0, 0, width, height);
                      System.IO.Directory.CreateDirectory(Server.MapPath("~/Fotky/") + id.ToString());
                      using (var output = System.IO.File.Create(path + "_small" + Path.GetExtension(fileName)))
                      {
                          thumb.Save(output, System.Drawing.Imaging.ImageFormat.Jpeg);
                      }
                  }
              }
              fileData.SaveAs(path + Path.GetExtension(fileName));
  
              return "ok";
          }
  </code></pre>
  
  <p>as you can see I am using id as 2 as default, but I want to get it from parameters, is it posible? And how? Thank you</p>
  
  <p>No one knows answer? It´s really important for me</p>