Problem with Custom Adapter getting called

Apr 15, 2009 at 4:40 PM
Edited Apr 15, 2009 at 4:47 PM
    I am using this terrific control to replace an existing implementation of the ASP FileUpload control. I have a custom control that includes the FileUploader. I am storing the files in a SQL database. 
    So, I am adding the FileUploader dynamically, I am adding my SQLAdapter to the Adapter Collection of the FileUploader. This renders just fine and workes as advertised until I upload the files. 
    In DEBUG I am not able to see any activity with my custom adapter.

    This is the adapter code:

public class SQLUploadAdapter : com.flajaxian.FileUploaderAdapter



      private string _parentID = string.Empty; 
        private string _uploadedBy = string.Empty; 
public string ParentID { get { return _parentID; } set { _parentID = value; } } 
        public string UploadedBy { get { return _uploadedBy; } set { _uploadedBy = value; } }

public override void ProcessFile(HttpPostedFile file) 


byte[] buffer = new byte[file.ContentLength]; 
    file.InputStream.Read(buffer, 0, file.ContentLength);   

DataAccess.ExecuteNonQuery("insert_attachment", DataAccess.NewStrongbox_FormsConnection,
new SqlParameter("@setId", ParentID),
new SqlParameter("@data", buffer),
new SqlParameter("@uploadby", UploadedBy),
new SqlParameter("@contentType", file.ContentType), 
new SqlParameter("@filepath", file.FileName),
new SqlParameter("@contentLength", file.ContentLength));



catch (Exception ee) {


string script = "alert('There has been an error uploading this file. There is a 4 meg limit to the size of your file. The following message is from the Strongbox System:"; script += ee.Message +  "')";

ScriptManager.RegisterStartupScript(this.Parent,typeof(string), "08y7unfvgih409", script, true); 



The SQL statement has been proven correct and not the issue.  Can you tell me what is wrong? Can I add this custom adapter dynamically?



Apr 15, 2009 at 4:57 PM
Yes but only if you do that before OnLoad, for example OnInit.
Apr 15, 2009 at 4:58 PM
To add to this I am using the latest download of the .dll and the source. I can see that in the OnLoad event for the FileUploader that the test for FileIsPosted is returning false;

Any Ideas?

Apr 15, 2009 at 8:32 PM
Thank you very much. This is exactly what I was doing. I change the build from Load to Init and this corrected the issue. Again thank you very much.