私は最近音楽サイトに取り組んでいます。それは音楽ファイルです。 。 。通常、インターネットから収集されます。 。それで。 。収集手順が書かれました。
コードコピーは次のとおりです。
<%
onerrorresumenext
constuploadpath = "/uploads/" 'ファイルストレージパス
constallowfileext = "jpg、wma、swf、gif" 'は、ファイルタイプを収集することを許可されました
'constallowfilesize = "200"
functiongetfile(url)
ifurl = "" then
exitFunction
それ以外
url = trim(url)
endif
'ファイルを取得します
fileext = lcase(mid(url、instrrev(url、 "。")+1) 'ファイルタイプ
filename = lcase(mid(url、instrrev(url、 "/")+1、instrrev(url、 "。") - instrrev(url、 "/")-1) 'ファイルタイプのファイル名なし
newFilePath = getNow( "date")& "_"&fact(formatdatetime(now()、3)、 ":"、 "")& "_"&cleanfileName(filename)& "。"&fileext
ifinstr( "、"&lcase(approwfileext)& "、"、 "、"、 "&fileext&"、 ")= 0then
getFile = "ファイルタイプは許可されていません"
exitFunction
endif
setXmlhttp = server.createObject( "microsoft.xmlhttp")
xmlhttp.open "get"、url、false
xmlhttp.send
'whorxmlhttp.ReadyState <> 4
'xmlhttp.waitforresponse1000
'ウェンド
ifxmlhttp.status <> 200then
getFile = "ファイルの取得エラー"
exitFunction
それ以外
setFolder = server.createObject( "Scripting.filesystemObject")
dimfoldername
foldername = getNow( "year")&getNow( "month") 'フォルダー
ifffolder.folderexists(server.mappath(uploadpath))= falsethen
folder.createfolderserver.mappath(uploadpath)
endif
ifffolder.folderexists(server.mappath(uploadpath&foldername))= falsethen
folder.createfolderserver.mappath(uploadpath&foldername)