|
|
|
อยากทราบว่าเราจะเปลี่ยนชื่อรูปตอนเซฟลง Db และ folder ให้เป็นชื่อรูปตาม user id ได้อย่างไรคะ |
|
|
|
|
|
|
|
อยากทราบว่าเราจะเปลี่ยนชื่อรูปตอนเซฟลง Db และ folder ให้เป็นชื่อรูปตาม user id ได้อย่างไรคะ
Code (ASP)
<%
name = uploaddata.Item("name").Item("value")
filename = uploaddata.Item("picture").Item("filename")
pos_filebegin = InstrRev(filename,"\")
pos_fileend = Len(filename)
filename_new = Mid(filename)
If Instr(filename_new,".jpg")<>0 then
Set conn = Server.CreateObject("ADODB.Connection")
conn.open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("sticker.mdb")
sql = "Select Snumber,Stopic,Sdescription,Sname,Sdate,Sfilename from sticker order by Snumber Desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn,1,3
rs.AddNew
rs("Snumber")=number
rs("Stopic")=topic
rs("Sdescription")=description
rs("Sname")=name
rs("Sdate")=date
rs("Sfilename")=filename_new
rs.Update
rs.Close
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set newfolder = fs.CreateFolder(Server.Mappath(number))
Set uploadfile = fs.CreateTextFile(Server.mappath(number&"/"&filename_new))
uploadfile.Write uploaddata.Item("picture").Item("value")
uploadfile.Close
%>
Tag : ASP
|
ประวัติการแก้ไข 2012-11-01 15:29:39
|
|
|
|
|
Date :
2012-11-01 15:10:53 |
By :
typex |
View :
1364 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (ASP)
filename_new = Session("UserID") & "_" &Mid(filename)
|
|
|
|
|
Date :
2012-11-01 17:15:29 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้าเราจะนำ resize imageจากตัวอย่าง https://www.thaicreate.com/asp/asp-resize-image.html มาใส่ในโค๊ดนี้ให้เข้ากันได้ยังไงคะ
Code (ASP)
<%
name = uploaddata.Item("name").Item("value")
filename = uploaddata.Item("picture").Item("filename")
pos_filebegin = InstrRev(filename,"\")
pos_fileend = Len(filename)
filename_new = Mid(filename)
If Instr(filename_new,".jpg")<>0 then
Set conn = Server.CreateObject("ADODB.Connection")
conn.open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("sticker.mdb")
sql = "Select Snumber,Stopic,Sdescription,Sname,Sdate,Sfilename from sticker order by Snumber Desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn,1,3
rs.AddNew
rs("Snumber")=number
rs("Stopic")=topic
rs("Sdescription")=description
rs("Sname")=name
rs("Sdate")=date
rs("Sfilename")=filename_new
rs.Update
rs.Close
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set newfolder = fs.CreateFolder(Server.Mappath(number))
Set uploadfile = fs.CreateTextFile(Server.mappath(number&"/"&filename_new))
uploadfile.Write uploaddata.Item("picture").Item("value")
uploadfile.Close
%>
|
|
|
|
|
Date :
2012-11-02 09:23:24 |
By :
typex |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองดูก่อนครับ ไม่ยากหรอกครับ แล้วค่อยมาถามอีกทีครับ
|
|
|
|
|
Date :
2012-11-02 09:38:20 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|