hello;
I need help about file upload;
I will take a file after save the Oracle db;
My oracle db type ;
FILEID INTEGER
MACHINENAME VARCHAR2 (30 Byte)
DOSYATYPE VARCHAR2 (30 Byte)
DOSYA BLOB
ICERIK VARCHAR2 (100 Byte)
YUKLEME_TARIH DATE
ONCEKI_DOSYA_ID INTEGER
and in code
and in Codebihend
string filePath =fulDoc.PostedFile.FileName;
string filename = Path.GetFileName(filePath);
string ext = Path.GetExtension(filename);
string contenttype = String.Empty;
switch (ext)
{
case ".doc":
contenttype = "application/vnd.ms-word";
break;
case ".docx":
contenttype = "application/vnd.ms-word";
break;
case ".xls":
contenttype = "application/vnd.ms-excel";
break;
case ".xlsx":
contenttype = "application/vnd.ms-excel";
break;
case ".jpg":
contenttype = "image/jpg";
break;
case ".png":
contenttype = "image/png";
break;
case ".gif":
contenttype = "image/gif";
break;
case ".pdf":
contenttype = "application/pdf";
break;
}
if (fulDoc.PostedFile != null && fulDoc.PostedFile.FileName != "")
{
Stream fs = fulDoc.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
docquery="INSERT INTO DOCUMENTS "+
"( FILEID , MACHINENAME ,"+
"DOSYATYPE , DOSYA ,"+
"ICERIK , YUKLEME_TARIH ,"+
"ONCEKI_DOSYA_ID )VALUES("+
"1, '"+machinename+"', '"+docname+"' , "+
"'" + bytes + "' , '" + doccontent + "' , " +
"'"+DateTime.Today+"' , '0')";
SQLQueries sq = new SQLQueries(docquery);
sq.CreateConnection();
sq.DataInsert();
sq.CloseConnection();
}
at SQLQueries there is my connection code. When I run the query is;
INSERT INTO DOCUMENTS ( FILEID , MACHINENAME ,DOSYATYPE , DOSYA ,ICERIK , YUKLEME_TARIH ,ONCEKI_DOSYA_ID )VALUES(1, 'xxxx', '' , 'System.Byte[]' , '' , '23.08.2012' , '0')
but it isn't work :(
Please Help :)