Estoy trabajando en un sitio de música recientemente, es un archivo de música. . . Por lo general, se recolecta de Internet. . entonces. . Se escribió un procedimiento de colección.
La copia del código es la siguiente:
<%
OnerrorResumEnext
Ruta de almacenamiento de archivos ConstuploadPath = "/uploads/" '
ConstallowFileExt = "JPG, WMA, SWF, GIF" 'se permite recopilar tipos de archivos
'ConstallowFilesize = "200"
FunctetFile (URL)
Ifurl = "" entonces
Extinción
Demás
URL = TRIM (URL)
Endif
'Obtenga el archivo
FileExt = lcase (Mid (URL, Instrrev (URL, ".")+1)) 'Tipo de archivo
FileName = lcase (Mid (URL, Instrrev (URL, "/")+1, Instrrev (URL, ".")-INSTREV (URL, "/")-1)) 'No hay nombre de archivo Nombre de archivo
newFilePath = getNow ("fecha") y "_" y reemplazar (formatDateTime (ahora (), 3), ":", "") y "_" & CleanFileName (nombre de archivo) & "" & FileExt.
ifinstr ("," & lcase (suodifileext) & ",", "," y fileext & ",") = 0then
getFile = "Tipo de archivo no permitido"
Extinción
Endif
Setxmlhttp = server.createObject ("Microsoft.xmlhttp")
xmlhttp.open "Get", URL, falso
xmlhttp.send
'Whilexmlhttp.readyState <> 4
'xmlhttp.waitForResponse1000
'Encaminarse a
Ifxmlhttp.status <> 200then
getFile = "Error al obtener archivo"
Extinción
Demás
Setfolder = server.createObject ("scripting.filesystemObject")
Nombre dimfolder
FolderName = getNow ("año") y getNow ("mes") 'Carpeta
Ifffolder.foldereRexists (server.mappath (uploadPath)) = falsethen
carpeta.createFolderServer.mappath (SubloadPath)
Endif
Ifffolder.foldereRexists (server.mappath (uploadPath & folderName)) = falsethen
carpeta.createFolderServer.mappath (SubloadPath & FolderName)