|
|
|
รบกวนช่วยดูโค้ดให้หน่อยค่ะทำมันไม่ยอม เซฟลงdatabase ค่ะ แต่ถ้าเอา '"&Request.Form("code")&"' ตัวนี้ออก มันสามารถเซฟได้ตามปกติ |
|
|
|
|
|
|
|
รบกวนช่วยดูโค้ดให้หน่อยค่ะทำมันไม่ยอม เซฟลงdatabase ค่ะ แต่ถ้าเอา '"&Request.Form("code")&"' ตัวนี้ออก มันสามารถเซฟได้ตามปกติ ขอคำแนะนำด้วยค่ะ
Code (ASP)
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP & Upload Resize</title>
</head>
<body>
<%
Dim mySmartUpload
Dim Conn,strSQL,objExec
'*** Create Object ***'
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
'*** Upload Files ***'
mySmartUpload.Upload
Dim sFileName,strPath
strPath = "MyResize"
sFileName = mySmartUpload.Files("file1").FileName
'*** Upload file1 ***'
If mySmartUpload.Files("file1").FileName <> "" Then
mySmartUpload.Files("file1").SaveAs(Server.MapPath(strPath & "/" & sFileName))
Response.write sFileName & " Resize Successful.<br>"
'*** Resize Images ***'
Dim Chs, objConst,NewWidth,NewHeight
Dim OutFormat,OutFileName
OutFormat = "Jpg" '*** Gif,Png ***'
OutFileName = "Thumbnails_"&sFileName
NewWidth = "100" '*** Set new Width , Height automatic caculate ***'
NewHeight = 0 '*** Auto Resize ***'
'*** Get Images Width & Height ***'
Dim objFso,myImg,Width,Height
Set objFso = Server.CreateObject("Scripting.FileSystemObject")
IF objFso.FileExists(Server.MapPath(strPath&"/"&sFileName)) Then
set myImg = Loadpicture(Server.MapPath(strPath&"/"&sFileName))
Width = Round(myImg.width / 26.4583)
Height = Round(myImg.height / 26.4583)
NewHeight = Round((NewWidth*Height)/Width)
'NewHeight = 100
'NewWidth = Round((NewHeight*Width)/Height) '*** or Automatic Height ***'
End If
'*************** End *************'
Set Chs = Server.CreateObject("OWC10.ChartSpace")
Set objConst = Chs.Constants
Chs.Interior.SetTextured Server.MapPath(strPath&"/"&sFileName), objConst.chStretchPlot, , objConst.chAllFaces
Chs.border.color = -3
'Chs.border.color = &H0000FF
'Chs.border.Weight = 3
Chs.ExportPicture Server.MapPath(strPath&"/"&OutFileName),OutFormat,NewWidth,NewHeight
Set objConst = Nothing
Set Chs = Nothing
'*** Insert Record ***'
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=localhost;Database=mydatabase;Uname=THAISINTO\administrator;PWD=;"
strSQL = ""
strSQL = strSQL &"INSERT INTO STAFF "
strSQL = strSQL &"(staff_code,staff_photo,upsize_ts)"
strSQL = strSQL &"VALUES "
strSQL = strSQL &"('"&Request.Form("code")&"','"&OutFileName&"','"&sFileName&"')"
Set objExec = Conn.Execute(strSQL)
End If
Response.write("View files")
Set mySmartUpload = Nothing
%>
</body>
</html>
Tag : ASP, Ms SQL Server 2005
|
|
|
|
|
|
Date :
2011-06-13 15:42:25 |
By :
gusjang |
View :
1337 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (ASP)
mySmartUpload.Form("code")
กรณีใช้ร่วมกับ SmartUpload จะไม่สามารถใช้ Request.Form ได้ครับ (ASP รุ่นเก่าไม่รู้ทำเพื่ออะไร)
Go to : ASP aspSmartUpload - Upload and Other Element
|
|
|
|
|
Date :
2011-06-13 18:14:19 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|