SqlConnection conn = 새 SqlConnection ("데이터 원본 = DDPRO8-WIN7X86 \ SQLEXPRESS; 초기 카탈로그 = mp3bytes; 보안 정보 유지 = True, 통합 보안 = true, 사용자 ID = ; "); SqlCommand cmd = null; SqlParameter param = null; cmd = 새 SqlCommand ("INSERT INTO mp3_bytes (노래)"+ "값 (@songs)", conn); FileStream fs = null;파일 업로드 컨트롤에서 파일 스트림으로 파일 이름 전달
string path = fileUpload.FileName;
fs = new FileStream(path, FileMode.Open, FileAccess.Read);
Byte[] song = new Byte[fs.Length];
fs.Read(song, 0, song.Length);
fs.Close();
param = new SqlParameter("@songs", SqlDbType.VarBinary, song.Length, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, song);
cmd.Parameters.Add(param);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
파일 업로드 파일 업로드 컨트롤입니다
.. 제가 mp3 파일을 업로드하고 .. 내가 어떻게 업로드에서 FILESTREAM하는 업로드 된 파일 이름을 전달할 수 있습니다 ''파일을 찾을 수 없습니다지고있어이를 실행할 때 fileUpload.HasFile 속성을 사용하여 업로드 된 모든 파일이 있으면 파일 제어 ..
당신을 감사합니다 ..
나는 이걸 시도 했지 .. – Leema
하지만이 경우에는 데이터베이스에 바이트 배열로 mp3 파일을 저장해야 하나? – Leema
안녕 thaaaaaanks 지금은 작동 ... – Leema