Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP Forum > ASP save เราเขียน program ASP ไม่ได้อ่ะที่ save ภาพ ไฟล์ หรือว่า ไฟล์รูปภาพอ่ะ ลงในdatabase ไม่ได้



 

ASP save เราเขียน program ASP ไม่ได้อ่ะที่ save ภาพ ไฟล์ หรือว่า ไฟล์รูปภาพอ่ะ ลงในdatabase ไม่ได้

 



Topic : 003071

Guest




เราเขียน program ASP ไม่ได้อ่ะที่ save ภาพ ไฟล์ หรือว่า ไฟล์รูปภาพอ่ะ ลงในdatabase ไม่ได้
มัน error ใครcode ได้ บอกเราหน่อยสิ หรือว่าถ้าcode เสร็จภายใน 2วันได้เราจะจ้าง
add mail เราไว้ได้ จะได้คุยกันค่ะ [email protected] เราจะส่งวันที่ 2แล้วอ่ะ
ใครช่วยได้ตอนนี้เราอยู่ปทุม เราต้องการความช่วยเหลือตอนนี้เลย หน้าล่ะเท่าไหร่คงไม่แพงนะ
อือ ช่วยหน่อยนะค่ะถ้าใครอ่านแล้ว หรือมีเพือน codeได้อยากได้ตังค์ ถ้าคุยรู้เรื่องแล้วเราจะโทร
ให้ช่วย
ขอบคุณค่ะ


Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 25 ก.พ. 2548 12:48:57 By : เล็กน้อย View : 2689 Reply : 3
 

 

No. 1

Guest


******************************
up_to_dbase_example.asp < send to database>

******************************

<%
response.buffer = true
Dim Uploader, File
Set Uploader = New FileUploader
Uploader.Upload()

Response.Write "<b>การส่งข้อมูลเสร็จสมบูรณ์" & Uploader.Form("fullname") & "</b><br>"
' Check if any files were uploaded
If Uploader.Files.Count = 0 Then
Response.Write "ไม่สามารถส่งข้อมูลได้เนื่องจากข้อมูลไม่มีการเลือกรูปภาพ"
Else
' Loop through the uploaded files
For Each File In Uploader.Files.Items
Dim RS,Con,Cstring,sql,MYMESSAGE,i,j
CString = "DBQ=" & Server.Mappath("../database/News.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set CON = server.CreateObject("adodb.connection")
Con.open Cstring
Set RS = Server.CreateObject("ADODB.Recordset")
SQL= "SELECT filename, filesize, contenttype, filedata, fullname, EMAIL, Head, story, News, D, t from Activity"
RS.Open SQL,con,2,3
RS.AddNew
RS("filename") = File.FileName
RS("filesize") = File.FileSize
RS("contenttype") = File.ContentType
RS("FULLNAME") = Uploader.Form("fullname")
RS("EMAIL") = Uploader.Form("EMAIL")
RS("Head") = Uploader.Form("Head")
RS("story") = Uploader.Form("story")
RS("News") = Uploader.Form("News")
RS("D") = DATE
RS("T") = TIME
' Save the file to the database
File.SaveToDatabase RS("filedata")
' Commit the changes and close
RS.Update
RS.Close
' Output the file details to the browser
'here I added a redirect to the display page
response.write "Uploading file: " & File.FileName & "<br>"
response.flush
'process logic here, for testing
for i = 0 to 100000
for j = 0 to 20
next
next
response.write "Done processing, sending you after 3sec to the display page<br>"
Response.Write "File Uploaded : &bsp" & File.FileName & "<br>"
Response.Write "Size : &bsp" & File.FileSize & " bytes<br>"
Response.Write "Type : &bsp " & File.ContentType & "<br>"
response.flush
Next
End If
%>

*****************************

Configurations.asp

*****************************
<%
Dim ID
ID = Request.QueryString("ID")
Dim Conn, RS, SQL
SQL = "SELECT filedata FROM Activity WHERE ID = " & ID
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DBQ=" & Server.Mappath("../database/News.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, Conn
Response.ContentType = "image/jpg"
Response.BinaryWrite RS("filedata")
RS.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing
%>

*************************************************
photo_upload.asp

*************************
<%
Class FileUploader
Public Files
Private mcolFormElem

Private Sub Class_Initialize()
Set Files = Server.CreateObject("Scripting.Dictionary")
Set mcolFormElem = Server.CreateObject("Scripting.Dictionary")
End Sub

Private Sub Class_Terminate()
If IsObject(Files) Then
Files.RemoveAll()
Set Files = Nothing
End If
If IsObject(mcolFormElem) Then
mcolFormElem.RemoveAll()
Set mcolFormElem = Nothing
End If
End Sub

Public Property Get Form(sIndex)
Form = ""
If mcolFormElem.Exists(LCase(sIndex)) Then Form = mcolFormElem.Item(LCase(sIndex))
End Property

Public Default Sub Upload()
Dim biData, sInputName
Dim nPosBegin, nPosEnd, nPos, vDataBounds, nDataBoundPos
Dim nPosFile, nPosBound

biData = Request.BinaryRead(Request.TotalBytes)
nPosBegin = 1
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))

If (nPosEnd-nPosBegin) <= 0 Then Exit Sub

vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
nDataBoundPos = InstrB(1, biData, vDataBounds)

Do Until nDataBoundPos = InstrB(biData, vDataBounds & CByteString("--"))

nPos = InstrB(nDataBoundPos, biData, CByteString("Content-Disposition"))
nPos = InstrB(nPos, biData, CByteString("name="))
nPosBegin = nPos + 6
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))
sInputName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
nPosFile = InstrB(nDataBoundPos, biData, CByteString("filename="))
nPosBound = InstrB(nPosEnd, biData, vDataBounds)

If nPosFile <> 0 And nPosFile < nPosBound Then
Dim oUploadFile, sFileName
Set oUploadFile = New UploadedFile

nPosBegin = nPosFile + 10
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))
sFileName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
oUploadFile.FileName = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\"))

nPos = InstrB(nPosEnd, biData, CByteString("Content-Type:"))
nPosBegin = nPos + 14
nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))

oUploadFile.ContentType = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))

nPosBegin = nPosEnd+4
nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
oUploadFile.FileData = MidB(biData, nPosBegin, nPosEnd-nPosBegin)

If oUploadFile.FileSize > 0 Then Files.Add LCase(sInputName), oUploadFile
Else
nPos = InstrB(nPos, biData, CByteString(Chr(13)))
nPosBegin = nPos + 4
nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
If Not mcolFormElem.Exists(LCase(sInputName)) Then mcolFormElem.Add LCase(sInputName), CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
End If

nDataBoundPos = InstrB(nDataBoundPos + LenB(vDataBounds), biData, vDataBounds)
Loop
End Sub

'String to byte string conversion
Private Function CByteString(sString)
Dim nIndex
For nIndex = 1 to Len(sString)
CByteString = CByteString & ChrB(AscB(Mid(sString,nIndex,1)))
Next
End Function

'Byte string to string conversion
Private Function CWideString(bsString)
Dim nIndex
CWideString =""
For nIndex = 1 to LenB(bsString)
CWideString = CWideString & Chr(AscB(MidB(bsString,nIndex,1)))
Next
End Function
End Class

Class UploadedFile
Public ContentType
Public FileName
Public FileData

Public Property Get FileSize()
FileSize = LenB(FileData)
End Property

Public Sub SaveToDatabase(ByRef oField)
If LenB(FileData) = 0 Then Exit Sub

If IsObject(oField) Then
oField.AppendChunk FileData
End If
End Sub

End Class
%>
******************************


มันใช้หลายตัวอะ ผมว่าคุณเมลล์มาหาผมดีกว่าจะส่ง Code ไปให้ ถ้าสนใจ..........






Date : 25 ก.พ. 2548 14:45:25 By : srathee
 


 

No. 2

Guest



Date : 21 ธ.ค. 2550 20:30:33 By : D
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ASP save เราเขียน program ASP ไม่ได้อ่ะที่ save ภาพ ไฟล์ หรือว่า ไฟล์รูปภาพอ่ะ ลงในdatabase ไม่ได้
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่