ممنون از کمکهاتون.
فایل رو تو داتابیس ذخیره کردم ولی در مورد بازیابی و ذخیره ان یک مشکل کوچیک دارم.
عکسارو تونستم بازیابی کنم ولی در مورد فایلهای دیگر انها رو خراب میکنه.
قالب ان رو هم یک دفعه با image یک دفعه با binary امتحان کردم ولی جواب نداد.
فکر کنم فایلهایی که ظرفیتشون زیاده رو ذخیره نمیکنه. کجای کار اشتباست؟؟؟
byte[] ReadFile(string sPath)
{
//Initialize byte array with a null value initially.
byte[] data = null;
//Use FileInfo object to get file size.
FileInfo fInfo = new FileInfo(sPath);
long numBytes = fInfo.Length;
//Open FileStream to read file
FileStream fStream = new FileStream(sPath, FileMode.Open, FileAccess.Read);
//Use BinaryReader to read file stream into byte array.
BinaryReader br = new BinaryReader(fStream);
//When you use BinaryReader, you need to supply number of bytes to read from file.
//In this case we want to read entire file. So supplying total number of bytes.
data = br.ReadBytes((int)numBytes);
return data;
}
void WriteFile(byte[] sbite,string addras)
{
//Initialize byte array with a null value initially.
//Use FileInfo object to get file size.
FileInfo fInfo = new FileInfo(addras);
// long numBytes = fInfo.Length;
//Open FileStream to read file
FileStream fStream = new FileStream(addras, FileMode.OpenOrCreate, FileAccess.Write);
//Use BinaryReader to read file stream into byte array.
BinaryWriter br = new BinaryWriter(fStream);
//When you use BinaryReader, you need to supply number of bytes to read from file.
//In this case we want to read entire file. So supplying total number of bytes.
br.Write(sbite);
br.Close();
}