Multiple image upload with jquery plugin
I got this simple jquery plugin to upload files.
i can add multiple files, but i cant seem to write a code that saves all the files, only one..
var _thumb = str开发者_高级运维ing.Empty;
if (!string.IsNullOrEmpty(fuUploadThumps.FileName))
{
_thumb = fuUploadThumps.FileName;
fuUploadThumps.SaveAs(Request.PhysicalApplicationPath + @"\img/produkter\" + _imagePath["categoryImagePath"] + "resized/thumbs/" + StripInput(_thumb));
}
Can anyone help me?
More code
_objAdmin.Name = StripInput(_thumb);
_objAdmin.Connection = Session["imageConnection"].ToString();
_objAdmin.AddThumbs(_objAdmin);
Thats all :=)
What I think jnoreiga is trying to tell you, is to request the files like you request the physical applicationpath. Just like so:
var hfc = Request.Files;
for (var i = 0; i < hfc.Count; i++)
{
var hpf = hfc[i];
if (hpf.ContentLength > 0)
{
var _thumb = hpf.FileName;
hpf.SaveAs(
Request.PhysicalApplicationPath + @"\img/produkter\" + _imagePath["categoryImagePath"] + "resized/thumbs/" + StripInput(_thumb)
);
}
else
{
return string.Format("Add some data on file number: {0}, please? :-)", i);
}
}
You have to loop though the requests' file array.
foreach (HttpPostedFileBase file in request.Files)
{
string filename = file.FileName;
}
精彩评论