السلاااام عليكم ورحمة الله
في البدايه اتشرف بالتسجيل في المنتدى الرائع بروعة اعضاءه
واتقدم بطلبي للاخوه الخبراء والمتمرسين للغة ASP
حيث انني صممت الصفحات والفورمز وباقي كود العرض والتحميل
الرجاء تزويدي بالكود باسرع وقت ممكن
وجزيل الشكر لكم جميعا
السلاااام عليكم ورحمة الله
في البدايه اتشرف بالتسجيل في المنتدى الرائع بروعة اعضاءه
واتقدم بطلبي للاخوه الخبراء والمتمرسين للغة ASP
حيث انني صممت الصفحات والفورمز وباقي كود العرض والتحميل
الرجاء تزويدي بالكود باسرع وقت ممكن
وجزيل الشكر لكم جميعا
استخدم الملف المرفق
اذهب الى الHelp واكتب Upload
وسوف تجد الحل مباشره
وهذا مثال على الupload
قم باضافة هذا الكنترول
<INPUT id="oFile" style="Z-INDEX: 103; LEFT: 224px; POSITION: absolute; TOP: 207px" type="file" runat="server">
ثم قم باضافة زر للupload
واكتب التالي داخل الevent
Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Dim connstr As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("dbImages.mdb")
Dim cnn As New OleDbConnection(connstr)
Dim cmdInsert As New OleDbCommand
Dim strCateGorie, strNaam, strBeschrijving As String
Dim strFileName As String
Dim strFilePath As String
Dim strFolder As String
strFolder = "مسار الفولدر اموجود في السيرفر اللذي سوف يتم تخزين الصور بداخله"
strCateGorie = cboCategorie.SelectedItem.Text
strNaam = txtNaam.Text
strBeschrijving = txtBeschrijving.Text
'Get the name of the file that is posted.
strFileName = oFile.PostedFile.FileName
' strFileName = Path.GetFileName(strFileName)
Try
'Create the directory if it does not exist.
If (Not Directory.Exists(strFolder)) Then
Directory.CreateDirectory(strFolder)
End If
'Save the uploaded file to the server.
strFilePath = strFolder & strFileName
If File.Exists(strFilePath) Then
lblUploadResult.Text = strFileName & " already exists on the server!"
lblUploadResult.Visible = True
Else
oFile.PostedFile.SaveAs(strFilePath)
lblUploadResult.Text = strFolder & strFileName & " has been successfully uploaded."
lblUploadResult.Visible = True
End If
'Display the result of the upload.
' frmConfirmation.Visible = True
cmdInsert.CommandText = "Insert Into tblfoto " _
& "(Categorie,Naam,Beschrijving,Filename) " _
& "Values (" _
& "'" & strCateGorie & "', " _
& "'" & strNaam & "', " _
& "'" & strBeschrijving & "', " _
& "'" & strFilePath & "')"
cmdInsert.Connection = cnn
cmdInsert.Connection.Open()
cmdInsert.ExecuteNonQuery()
cnn.Close()
'Maak de tekstvelden schoon
Call clearfields()
cboCategorie.Items.Clear()
Call _InitCboCatNaam()
Catch ex As Exception
lblUploadResult.Text = "error: " + ex.Message
End Try
End Subبعد ذلك قم بالتعديل على الكود المرفق
وشكرا
هذا الموضوع مغلق.