프로그래밍/ASP

DEXTUpload 다중파일 업로드 및 정보가져오기

p-a-r-k 2014. 10. 22. 15:19
반응형

복습겸 정리하는 부분,,

filetest.html
<form name="form1" id="form1" method="post" enctype="multipart/form-data" target="hiddenFrame" action="fileapp.asp">
	<input type="file" name="files"><bR>
	<input type="file" name="files"><bR>
	<input type="file" name="files"><bR>
	<input type="submit" value="확인">
</form>
<iframe name="hiddenFrame" width="500" height="200" style="DISPLAY:;"></iframe>

fileapp.asp
<%
   Set Uploadform = Server.CreateObject("DEXT.FileUpload")
   Set objImage =server.CreateObject("DEXT.ImageProc")
   Set FSO = CreateObject("Scripting.FileSystemObject")
   Uploadform.AutoMakeFolder = TRUE
   Uploadform.DefaultPath = "D:\web\이미지저장경로\"

   nFileCnt = Uploadform("files").Count
   Dim arrFileName(2)

   For i = 1 to nFileCnt
      IF Uploadform("files")(i) <> "" Then
         Randomize
			selNo = Int((99999 * Rnd) + 1)
			sDate2 = Right("0" & Minute(Now),2) & Right("0" & Second(Now),2) & "_" & selNo
			arrFileName(i-1) = sDate2 & "." & "jpg"

			'원본 저장
			uploadform("files")(i).SaveAs UploadForm.DefaultPath &"\B\" & arrFileName(i-1)
			'썸네일 저장
			If objImage.SetSourceFile(UploadForm.DefaultPath &"\B\" & arrFileName(i-1)) = True then
				'썸네일 이미지 퀄리티 조정
				objImage.Quality = 100
					sFileWidth = objImage.ImageWidth
					sFileHeight = objImage.ImageHeight
					 fThumbnail = objImage.SaveasThumbnail(UploadForm.DefaultPath &"\S\" & arrFileName(i-1), 200, 150, false, true)
			End If
      END IF
   Next

   For k = 0 to Ubound(arrFileName)
      IF arrFileName(k) <> "" THEN
         response.write k & ":"& arrFileName(k)
			'response.write "이름 : "& arrFileName(k).filename
			'response.write "용량 : "& arrFileName(k).filelen
      END IF
   Next
%>

SaveasThumbnail 의 5번째인자 true는 비율유지이다.

반응형