作者l8 (銅人)
看板Web_Design
標題[問題] 為什麼一定要加這一句呢?
時間Sun Sep 27 00:13:59 2009
我做了一個相簿,有批次上傳相片的功能(一次可以上傳幾十張照片)
上傳的介面使用 swfupload
縮圖使用了 overpower 元件
雖然程式可以執行 但有些小問題
使用者的介面是 a.asp 執行後會把資料送到 b.asp
以下是 b.asp 節錄重點的程式碼
<%
response.buffer=true
........
........
Set FS = CreateObject("Scripting.FileSystemObject")
Set Upload = Server.CreateObject("Persits.Upload")
strFolder="xxxx"
strFolders="xxxx/oooo"
strTestFolder=Server.Mappath(strFolder)
strTestFolders=Server.Mappath(strFolders)
If Not FS.FolderExists(strTestFolder) Then
FS.CreateFolder(strTestFolder)
End If
If Not FS.FolderExists(strTestFolders) Then
FS.CreateFolder(strTestFolders)
End If
Upload.OverwriteFiles = False
Count = Upload.Save (strTestFolder)
%>
----上面這一段主要是在管上傳圖片-----
----下面這一段則是把上傳後的圖片做縮圖----
<%
set File=Upload.Files(1)
name=File.FileName
F1=Server.MapPath("xxxx" & name)
set ILIB = server.createobject("Overpower.ImageLib")
ILIB.PictureSize F1, width, height
if width>800 then
imgwidth = 800 '需縮圖的寬度
imgheight = height*800/width '需縮圖的高度
else
imgwidth = width
imgheight = height
end if
ILIB.width = imgwidth '空白畫布寬度
ILIB.height = imgheight '空白畫布高度
ILIB.InsertPicture F1,0,0,True,imgwidth,imgheight
ILIB.PictureBinaryWrite 3,100,"" '直接輸出圖檔, 不存檔
ILIB.savePicture Server.MapPath("xxxx" & name) , 3, 95, ""
//
ILIB.width = 100 '空白畫布寬度
ILIB.height = 75 '空白畫布高度
ILIB.InsertPicture F1,0,0,True,100,75
ILIB.PictureBinaryWrite 3,100,"" '直接輸出圖檔, 不存檔
ILIB.savePicture Server.MapPath("xxxx/oooo/" & name) , 3, 100, ""
Set ILIB = Nothing
response.redirect "temp.htm"
%>
程式可以跑 也可以成功把照片上傳上去並全部縮圖
但是問題在於 我上面標黃色的這條
response.redirect "temp.htm"
temp.htm其實是個空白的網頁
加這句乍看之下一點意義也沒有
但是卻又不能不加 不加的話 只有第一張圖片能上傳成功
下面全部當掉 網頁出現錯誤訊息後就關閉了
加了這句之後 雖然在IE上面可以正常運作
但在FireFox上面 上傳介面會顯示紅色的錯誤訊息(但照片還是傳的上去)
總覺得這樣程式沒有寫的很好...囧....
有人知道我這是什麼原因嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
推 PsMonkey:有 VB 版,也有 C# 版阿.... 09/28 08:30
→ l8:可是這應該是ASP的問題 也不知道該哪裡問 囧 09/28 21:47
※ 編輯: l8 來自: 61.227.117.193 (12/13 09:51)