رفع ملف الى قاعدة البيانات حجمه اقل او يساوي 4 ميجات تنجح لكن عندما احاول رفع ملف يتجاوز 4 ميجا رسالة خطا:
internet explorer can not display the webpage
كود رفع ملف الى قاعدة البيانات:
'code upload
If FileUpload1.HasFile = True Then
Dim nom As String = FileUpload1.PostedFile.FileName
Dim mem As IO.Stream = FileUpload1.PostedFile.InputStream
' retourner l'extention du fichier
Dim Extention As String = IO.Path.GetExtension(FileUpload1.FileName)
' retourner la du fichier
Dim taille As Integer = FileUpload1.PostedFile.ContentLength
If taille <= 900000 Then
If Extention = ".rar" Or Extention = ".txt" Or Extention _
= ".pdf" Or Extention = ".JPG" Or Extention = ".PNG" Or Extention = ".GIF" Or Extention = ".DOC" Or Extention = ".ZIP" Then
Dim arraybyte As Byte() = New Byte(mem.Length) {}
mem.Read(arraybyte, 0, arraybyte.Length)
' identity is a function witch let to increase the id_sujet(id_thread) automaticly
Dim param As Integer = identity("id_Accessoire", "Accessoires")
cmd.CommandText = "insert into Accessoires(id_Accessoire,nom,myfile,id_sujet) values(@id_Accessoire,@nom,@myfile,@id_sujet)"
cmd.Parameters.AddWithValue("@id_Accessoire", param)
cmd.Parameters.AddWithValue("@nom", nom)
cmd.Parameters.AddWithValue("@myfile", arraybyte)
cmd.Parameters.AddWithValue("@id_sujet", 22)
If cnx.State = ConnectionState.Open Then cnx.Close()
cnx.Open()
cmd.ExecuteNonQuery()
cnx.Close()
Response.Write("upload ok")
Else
lbms.Text = "(.doc) او (.ZIP) او(.rar) او (.pdf) او (.txt) او (.jpg) او (.png) او (.Gif) يسمح فقط بالامتدادات التالية "
End If
Else
lbms.Text = " حجم الملف لايجب ان يتعدى 800 كيلو "
End If
Else
lbms.Text = "لم تقم بتحديد الملف"
End Ifكيف احل المشكلة??
وشكرا