 |
|
ASP.Net : Button อยู่ใน Repeater ไม่ทำงานตามคำสั่งเกิดจากอะไรคะ |
|
 |
|
|
 |
 |
|
ลองสร้างจากหน้า Properties ของ Control ครับ โดยไปหน้่า Design -> Controls -> Properties -> Event ที่ต้องการ
|
 |
 |
 |
 |
Date :
2015-02-22 10:11:22 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากคะ
พี่คะ หนูเอาเว็บไปรันบน iis แต่ว่าพวก fileupload มันไม่ สร้าง folder ไม่ เก็บภาพเลยคะ แต่ชื่อรูปภาพชื่อ path ถูกหมดคะ เป็นเพราะอะไรคะ รันกับโปรแกรมได้ปกตินะคะ
Code (VB.NET)
Protected Sub UploadThisFile(ByVal upload As FileUpload)
Dim rndnumber As Random
Dim number As Integer
rndnumber = New Random
number = rndnumber.Next(1, 80000)
Dim filename As String = number.ToString & "_" & upload.FileName
If FileUpload1.HasFile Then
Dim img As String = String.Empty
Dim bmpImg As Bitmap = Nothing
Try
bmpImg = Resize_Image(FileUpload1.PostedFile.InputStream, 960, 960)
bmpImg.ToString()
'Server.MapPath("~/Uploads")
img = Server.MapPath("~/Uploads/") + number.ToString + ".png"
ins_album(abname:=number.ToString + ".png", dir_name:=number.ToString)
bmpImg.Save(img, ImageFormat.Jpeg)
Catch ex As Exception
Response.Write("Error occured: " & ex.Message.ToString())
Finally
img = String.Empty
bmpImg.Dispose()
End Try
End If
End Sub
Code (VB.NET)
Private Function Resize_Image(ByVal streamImage As Stream, ByVal maxWidth As Integer, ByVal maxHeight As Integer) As Bitmap
Dim originalImage As New Bitmap(streamImage)
Dim newWidth As Integer = originalImage.Width
Dim newHeight As Integer = originalImage.Height
Dim aspectRatio As Double = CDbl(originalImage.Width) / CDbl(originalImage.Height)
If aspectRatio <= 1 AndAlso originalImage.Width > maxWidth Then
newWidth = maxWidth
newHeight = CInt(Math.Round(newWidth / aspectRatio))
ElseIf aspectRatio > 1 AndAlso originalImage.Height > maxHeight Then
newHeight = maxHeight
newWidth = CInt(Math.Round(newHeight * aspectRatio))
End If
Return New Bitmap(originalImage, newWidth, newHeight)
End Function
|
 |
 |
 |
 |
Date :
2015-02-24 10:26:01 |
By :
mooer |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หากจะเขียนไฟใดไลงในโฟดเดอร์ของแอบ asp.net มันต้องเพิ่ม permission ลงด้วยนะครัช
ในกรณีที่ยังพัฒนาด้วย Visual studio (ห้องภาพเสมือนจริง ตึ่งโป๊ะ) แต่ถ้าเอาไปติดตั้งใน server
ใน app pool ของ iis มันก็ต้องจัดการด้วย iis นะครัช
เดาว่าน่าจะเป็นอย่างแรก แล้วทำเยี่ยงไร จริงๆอยากจะให้ไปค้นดูนะ
แต่ถือว่าช่วง promotion ละกันเนาะ .sh click ขวายังโฟดเดอร์ที่จะเขียนภาพหรือ upload ไฟลงไป
เลือก properties เลือก tab security >> click ที่ปุ่ม advance จะมีหน้าต่างดึ๋งออกมา กดปุ่ม add
จะมีหน้าต่างดึ๋งออกมาอีก click ที่ Select principal ตัวสีฟ้าๆน่ะ
จะมีหน้าต่างดึ๋งออกมาอีกอันละ click ที่ advance ไปหา asp.net user หรือจะ IIS_IUSR
แล้ว add เป็น full permission
และเมื่อมันยุ่งยากอย่างนี้นั้นหลายชีวิตจึงหันไป save image ลงฐานข้อมูลตรงๆไปเลย
หวังว่าคงจะได้นะครัช
|
 |
 |
 |
 |
Date :
2015-02-24 12:16:50 |
By :
DOG{B} |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณสำหรับ promotion มากๆคะ  
|
 |
 |
 |
 |
Date :
2015-02-27 10:05:24 |
By :
mooer |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|