This question is locked. New answers and comments are not allowed.
Hi there,
I use in my application the radUpload and no problem. But in my ashx file when I try save the file in database, I don´t know why, but I can´t.
I implement my class this:
And the GuardaFicheiroBD method is responsable to save in database.
The Domain object represents my service, and the InsertAnexos method is the auto-generated method of ORM to insert in table ANEXOS.
There is some thing that I can´t see? Any helo?
Thanks in advance.
Nelson Silva
I use in my application the radUpload and no problem. But in my ashx file when I try save the file in database, I don´t know why, but I can´t.
I implement my class this:
ublic class DocumentosCarregados : RadUploadHandler { string Resultado; string ResDesignacao; SGADomainContext domain = new SGADomainContext(); List<string> listaDesignacoes = new List<string>(); List<string> listaDesignacoes2 = new List<string>(); public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes) { bool result = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes); if (this.IsFinalFileRequest()) { string uploadedFiles = this.GetQueryParameter("UploadedFiles"); Resultado = this.GetQueryParameter("DesignacaoFiles"); if (result) { foreach (string s in Resultado.Split(';')) { ResDesignacao = s.Remove(0, s.IndexOf('|') + 1); listaDesignacoes.Add(ResDesignacao); } GuardaFicheieroBD(contentLength, buffer, filePath); } } return result; } private void GuardaFicheieroBD(int tam, byte[] buffer, string path) { Anexos anexo = new Anexos(); anexo.IdProp = 0; anexo.ReuniaoIdProp = 1166; anexo.TipoDocumentoIdProp = 1045; anexo.DesignacaoProp = "Anexo"; anexo.FicheiroProp = 1;//existe ficheiro anexo.TamanhoFicheiroProp = null; anexo.UrlFicheiroProp = path; anexo.ConteudoProp = null; anexo.VisivelReuniaoProp = 1; anexo.SitProp = 1; anexo.InsUserProp = "Nelson"; anexo.InsDataProp = DateTime.Now; anexo.AltUserProp = "Nelson"; anexo.AltDataProp = DateTime.Now; anexo.VersaoProp = 0; domain.InsertAnexos(anexo); } public String ByteToString(byte[] b) { String t = ""; for (int i = 0; i < b.Length; i++) t = t + (char)b[i]; return t; } public override Dictionary<string, object> GetAssociatedData() { // here we are returning the name of the uploaded file // as custom parameters back to the clent-side: Dictionary<string, object> dict = base.GetAssociatedData(); dict.Add("UploadedFile", this.GetFilePath()); return dict; } }And the GuardaFicheiroBD method is responsable to save in database.
The Domain object represents my service, and the InsertAnexos method is the auto-generated method of ORM to insert in table ANEXOS.
There is some thing that I can´t see? Any helo?
Thanks in advance.
Nelson Silva