Welcome Guest Search | Active Topics | Sign In | Register

Cannot see files in AJAXUploader.PostedFiles Options
Duane
Posted: Monday, November 30, 2009 11:24:10 AM
Rank: Advanced Member
Groups: Member

Joined: 9/4/2007
Posts: 114
Hello,

Somewhere between the _27 and _38 build, the AJAXUploader stopped recognizing the .PostedFiles. The files upload to the temp directory, just like they did before, but when the I look for files in the PostedFiles propery, it returns {0} and files to move the files from the temp directory to the final location.

When it evaluates the "foreach(...)' statement, it fails and just displays the failed to save message, presumably becuase it sees no files. The Files (.info, .status, .data) for each upload attempt are in the c:\temp directory. This worked flawlessly until I updated to the _38 build.

Did the method of getting files from PostedFiles change since the _27 buld?

Below is a sample of my code ( largely taken from your sample ):

Code: C#
protected void ui_btn_SaveVideo_Click(object sender, EventArgs e)
    {
        VideoTitle = ui_txt_Video_Title.Text;
        Description = ui_txt_Video_Desc.Text;
        RequestID = Convert.ToInt32(requestID.Value);
        SelectedDisplayOrder = Convert.ToInt32(ui_ddl_SortOrder3.SelectedValue);

        string finalFileName = "";

        foreach (EO.Web.AJAXPostedFile file in AJAXUploader1.PostedFiles)
        {
            if (file.TempFileName == string.Empty)
            {
                ui_lbl_ErrorMessage.Text = "You did not upload your file, or file upload failed. please try again.";
                return;
            }

            //Get the temp file name
            string tempFileName = file.TempFileName;
            
            //Create the final file name based on the original file name
            finalFileName = System.IO.Path.Combine(@"c:\temp\", file.ClientFileName);
            
            //Move the file to the desired location
            if(System.IO.File.Exists(finalFileName))
            {
                System.IO.File.Delete(finalFileName);
            }
            System.IO.File.Move(tempFileName, finalFileName);
            break;  // Just grab the first one if the user uploaded more files.
        }


        if (finalFileName == string.Empty)
        {
            ui_lbl_ErrorMessage.Text = "Could not save the uploaded file, please try uploading again.";
            return;
        }



Thanks
eo_support
Posted: Monday, November 30, 2009 12:07:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Please try to set SavePostedFileList to true and see if that works.

Thanks!
Duane
Posted: Monday, November 30, 2009 12:19:56 PM
Rank: Advanced Member
Groups: Member

Joined: 9/4/2007
Posts: 114
Hello,
That worked. Is that a new requirement? Didn't need to set that property before the update.

Thanks,
eo_support
Posted: Monday, November 30, 2009 4:08:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
It is in your particular build. However we may change it so that it is no longer necessary. In any case explicitly setting it should not hurt.

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.