Rank: Advanced Member Groups: Member
Joined: 2/27/2009 Posts: 41
|
I'm uploading 5 jpg's which need numbered accordingly (slide_1.jpg, slide_2.jpg, etc...) in order for a Javascript slideshow to work correctly. The file upload to the correct directory (eo_upload2), but don't move to the new directory. Heres my code:
[asp.net] <eo:AJAXUploader runat="server" id="AJAXUploader2" Width="200px" ClientSideOnError="CustomErrorHandler" AutoPostBack="true" TempFileLocation="~/eo_upload2" MaxDataSize="30000" Rows="5" BrowseButtonText="Photo.jpg" OnFileUploaded="AJAXUploader2_FileUploaded"> </eo:AJAXUploader>
[.cs] protected void AJAXUploader2_FileUploaded(object sender, System.EventArgs e) { //Find 'AJAXUploader1' inside 'loginView1' EO.Web.AJAXUploader AJAXUploader2 = (EO.Web.AJAXUploader)loginView1.FindControl("AJAXUploader2");
foreach (EO.Web.AJAXPostedFile file in AJAXUploader2.PostedFiles) { int i = 1;
File.Move(file.TempFileName, Server.MapPath("~/locallinks/" + ((DropDownList)loginView1.FindControl("ddlCompany")).Text + "/slide_" + i + ".jpg"));
i++; }
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Your code appears to be fine as far as from the uploader point of view. So you may want to step through the debugger and see which step did not work as expected. The uploader should fire FileUploaded event and provide uploaded file information through its PostedFiles property. So if you believe something is wrong in this part, please create a test page to reproduce the problem and we will be happy to take a look. Once the uploader triggers the event and provide you the file information, your code should take care of everything else. So if you noticed something is wrong on this part (such as something related to your ddlCompany DropDownList), you will need to troubleshoot it by yourself.
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 2/27/2009 Posts: 41
|
I moved the int i = 1; out of the method and now it increments correctly. Seems the Multi-Row Updater method fires per file uploaded, which makes sense, just didn't think... Anyway, all is well... Thanks
|