Welcome Guest Search | Active Topics | Sign In | Register

Multi-Row Uploader OnFileUploaded jpg name change? Options
Pointeman
Posted: Tuesday, April 21, 2009 11:56:09 AM
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++;
}
eo_support
Posted: Tuesday, April 21, 2009 12:15:09 PM
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!
Pointeman
Posted: Tuesday, April 21, 2009 5:41:56 PM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.