파일 업로드 폴더 생성 및 다운로드

거너거너·2022년 2월 10일
0

asp

목록 보기
3/3
strDir = "C:\new\file\"&Replace(Year(date)&right("0"&Month(date),2),"-","")&"\"

If Not Fso.FolderExists(strDir) Then '폴더가 존재하지 않으면
strDir = Fso.CreateFolder(strDir) '폴더를 생성
Response.Write strDir & " 폴더 생성에 성공하였습니다."
Else
Response.Write strDir & " 폴더가 존재합니다."
End If
								
Set Fso = nothing

&Replace(Year(date)&right("0"&Month(date),2),"-","")&
파일 생성 날짜로 폴더 만드는 함수(예] 202202)

if문 으로 폴더 생성하기

		<%
		If isNull(upt_dt) Then
		%>
		<a class="plain2" href="/new/file/<%=Replace(Left(reg_dt,7),"-","")%>/<%=filename%>" target="_top" download><%=source_filename%></a>
		<%
		else
		%>
		<a class="plain2" href="/new/file/<%=Replace(Left(upt_dt,7),"-","")%>/<%=filename%>" target="_top" download><%=source_filename%></a>
		<%
		end if 
		%>

작성일 및 수정날 기준으로 폴더 생성
-> 날짜 폴더 불러오기(예]\new\file\202202)
-> A태그 안에 download = 뷰 페이지에서 바로 첨부파일 다운로드 가능

참고 사이트1
참고 사이트2

profile
배움이 필요한 사람

0개의 댓글