مراحل ایجاد یک فرمaspx و asp برای upload کردن فایل ها در وب سایت

من نمی دونم چه جوری مسیری برای ذخیره شدن فایل ها در برنامه بدم و اصلا چه چیزهایی یا چه تنظیماتی نیازه؟؟؟
به یه نمونه سورس کامل صفحه ای شامل فرم که از کاربر فایلی رو در یافت کنه و ان فایل یا تصویر رو یا در دیتابیس یا در پوشه ای در سرور ذخیره کنه نیاز دارم ممنون میشم اگه یه نمونه بذارید
 
کد 1
<html>
<head>
<title>VB Web ASP File Upload</title>
</head>
<body>
<form action="uploadcomplete.asp" method="POST" enctype="multipart/form-data">
<p>Please select a file to upload, and enter a description for it.</p>
<p><b>File: </b><input type="file" style="width: 300;" name="thefile"><br>
<b>Description:</b><br><textarea name="description" rows=4 cols=30></textarea></p>
<input type="submit" value="Upload">
</form>
</body>
</html>
 

MDP

Well-Known Member
اینم باری 1.1 Net. :

کد:
If IsPostBack Then
            Dim found As Boolean
            Dim ex() As String = {".bmp", ".gif", ".jpg", ".JPG", ".GIF", ".BMP", ".Gif", ".Jpg", ".JPg", ".GIf", ".GiF", ".BmP"}
            If File1.PostedFile.ContentLength <> 0 Then
                Dim s, d As String
                s = File1.PostedFile.FileName
                d = System.IO.Path.GetExtension(s)
                Dim x As Integer
                For x = 0 To 11
                    If d = ex(x) Then
                        found = True
                        Exit For
                    End If
                Next
                If found Then
                    s = System.IO.Path.GetFileName(s)
                    File1.PostedFile.SaveAs(Request.MapPath(".") & "\images\" & s)
                    SqlConnection1.Open()
                    SqlCommand1.Parameters(0).Value = "./images/" & s
                    SqlCommand1.Parameters(1).Value = TextBox1.Text
                    SqlCommand1.ExecuteNonQuery()
                    SqlConnection1.Close()
                    Label1.Text = "File Uploaded"
                Else
                    Label1.Text = "You Should Use only '.bmp' and '.gif' and '.jpg'"
                End If
            End If
        End If
 

جدیدترین ارسال ها

بالا