Multiple image uploads in C # / jquery

are there some downloadable images out there that are easy for users to upload images, like facebook ActiveX file downloader.

but free :)

I'm updating my questions, I've seen everyone recommend downloading the Flash downloader. I have a problem that I am using sessions, i "pass the id of the custom album to link to the uploaded image and the id of the user who uploaded the image

this is the code on the first page

  <div id="divUploadImage" style="display: none;">
                    <FlashUpload:FlashUpload ID="flashUpload" runat="server" UploadPage="Upload2.axd"
                        OnUploadComplete="UploadComplete()" FileTypeDescription="Images" FileTypes="*.gif; *.png; *.jpg; *.jpeg"
                        UploadFileSizeLimit="3000000" TotalUploadSizeLimit="40000000" />
                    <asp:LinkButton ID="LinkButton1" runat="server"></asp:LinkButton>
                </div>

      

and the code after loading on the second page

public void ProcessRequest(HttpContext context)
        {

  for (int j = 0; j < context.Request.Files.Count; j++)
                {

 HttpPostedFile uploadFile = context.Request.Files[j];
  SaveImages(uploadFile, "", albumid,out returnPhotoId); // my function to save ,albumId is the session
                 }
}

      

thank

+2


source to share


4 answers


Try using uplodify . He also uses a flash and I highly recommend it. It is a highly customizable and free product.

To post to another page after uploading all files:

Make 3 hidden fields:

<asp:HiddenField runat="server" ID="hdf_UserID" name="hdf_UserID"  />
<asp:HiddenField runat="server" ID="hdf_AlbumID" name="hdf_AlbumID" />
<asp:HiddenField runat="server" ID="hdf_ImageFiles" name="hdf_ImageFiles" />

      

and this is how you set up your button to post on the second page:

<asp:Button runat="server" ID="btn_Submit" PostBackUrl="YourPage.aspx" />

      

Once on the second page you can get the information from the request like so:

Request["hdf_UserID"].ToString()
Request["hdf_AlbumID"].ToString()
Request["hdf_ImageFiles"].ToString()

      



you can store all files in a hidden field and I would recommend | split then you can just do .split in another page

For the .ahx page of the loadable loader:

using the scriptData parameter you can pass information to the second page.

 var auth = "<% = Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value %>"
 var user = $('[id$=hdf_UserID]').val();
 var album = $('[id$=hdf_AlbumID]').val();

 $('[id$=fileInput]').uploadify({
        'uploader': '../Uploadify/uploadify.swf',
        'script': '../Uploadify/Upload2.ashx',
        'scriptData': {'Token': auth, 'User': user, 'Album': album},

      

in .ashx uploadify you can get scriptData like this:

string user = context.Request["User"];
string album = context.Request["Album"];

      

This code is loaded specific, but hopefully it helps you understand your

+8


source


Actually, this is done using Flash. There are many solutions on the internet. here is one of the codeproject.



+1


source


I used the library located at http://www.codeproject.com/KB/aspnet/FlashUpload.aspx a> for my project. It is quite lightweight and easy to modify.

Basically, it's a multi-file downloader written in Flex. It's simple enough that you can also unpack the code and make changes if you need to.

+1


source


I have successfully used Uploadify with ASP.NET MVC to create a multi-file upload script with auto image previews all inline with AJAX. One thing to keep in mind if you are using session variables in your upload action hitting SWFUpload / Uploadify is that Flash gets its own SessionID and whatever is put into the session after a Flash upload request is made to the Flash session.

+1


source







All Articles