tags:

views:

1077

answers:

5

is there out there any multiple upload images easy to users to upload images like the activex file uploader on facebook.

but free :)

i update my questions i saw that everyone recommend about the flash uploader. i have the problem that i"m using sessions, i"m passing the user album id for relation to the image that been uploaded and the user id that uploded the image

this is the code in 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 upload fire 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
                 }
}

thanks

+1  A: 

Actually, It is done with Flash. There are a plenty of solutions on the internet. here is one from codeproject.

Cleiton
Great minds think alike?
JustLoren
+1  A: 

I used the library located at http://www.codeproject.com/KB/aspnet/FlashUpload.aspx for my project. It's pretty lightweight and lends itself well to modification.

Basically, it's a multi-file uploader written in Flex. It's straightforward enough that you can also bust open the code and make changes if you need to.

JustLoren
1+ "Great minds think alike?" Sure LOL.
Cleiton
+6  A: 

Try using uplodify. It uses flash as well, and I highly recommend it. It is a highly customizeable and free product.

For posting to another page after uploading all files:

Make 3 hidden fields like so:

<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 here is how you set up your button to post to the second page:

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

Once on the second page you can grab the information out of the request like so:

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

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

For the .ahx page of the uploadify uploader:

using the scriptData option 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 the .ashx of uploadify you can get the scriptData by the following:

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

This code is uploadify specific but hopefully it will help you understand yours

jmein
+1 that looks great!
Cleiton
i"m using sessions and this my problem to using that, you have any solution?
avnic
what specifically are you using the sessions for?
jmein
i"m passing the userId, and albumId
avnic
If you are passing the userId and the albumId to next page why dont you store all information sent to the next page in hidden fields. Then when you post to the next page you can grab the information out of the Request like so: Request["userId"].ToString()
jmein
i didn't accully understand how can i grab hidden fields from the first page by the request
avnic
If you are posting the information to the next page, you can grab all controls from the previous page through the request.
jmein
Are you trying to pass the information to a file used by the uploader or to the next page after uploading all the files?
jmein
to the file used by the uploader
avnic
+1  A: 

I've successfully used Uploadify with ASP.NET MVC to create a multi-file upload script with automatic image previews all inline with AJAX. One thing to keep in mind if you use Session variables in your upload action being hit by SWFUpload/Uploadify is that Flash gets its own SessionID and anything placed in the Session after a Flash upload request is placed in the Flash Session.

Nathan Taylor
this is my problem actually , i'm using sessions you have any solution for this?
avnic
@avnic: It depends on *why* you're using the session. There is no way to have flash pick up your pre-existing session. One example of a workaround could be by storing your images in a folder associated with the userid, then check that folder from your main session. The workaround is really dependent on your implementation.
JustLoren
I agree! We really need more information as to your implementation in order to best answer this question. There are several options available to you, but the best one can only be given when we understand the whole scope of the project.
jmein
The solution I came up with was pretty hacky. I wrote a custom Session implementation that optionally accepts a SessionID as a parameter in order to modify another user's Session. The code here: http://stackoverflow.com/questions/1262054/asp-net-mvc-alternative-to-using-session/1262422#1262422 isn't quite the most recent iteration, but the only changes I've made is to the Add/Remove methods. I can't guarantee the quality of that code, but I can tell you that it does work in all my tests.
Nathan Taylor
A: 

thank for your 5.Answer . I got user id in my web application using generic handler.

soe