|
Pure ASP Upload option I needed so thought I'd share!!!
admin_upload_configure.asp
add at line 442 <option value="PureASP"<% If strUploadComponent = "PureASP" Then Response.Write(" selected") %>>PureASP</option>
functions_upload.asp
add at line 1 <!--#include file="../classes/clsUpload.asp"-->
Download https://code.google.com/p/bcms-a-asp-php-cms/source/browseetbeans/bcms/install/asp/inc/upload/?r=8 - https://code.google.com/p/bcms-a-asp-php-cms/source/browse/netbeans/bcms/install/asp/inc/upload/?r=8
add around 220
'****************************************** '*** ASP Upload Script **** '******************************************
'ASP Upload Case "PureASP"
'Set error trapping On Error Resume Next ' Instantiate Upload Class Set objUpload = New clsUpload
Dim objField Set objField = objUpload("file") 'Get the file name strNewFileName = objField.FileName
'Filter file name to remove anything that isn't allowed by the filters strNewFileName = formatFileName(strNewFileName)
'Check the file size is not above the max allowed size, this is done using a function not the compoent to stop an exception error lngErrorFileSize = fileSize(objField.Length, lngMaxFileSize)
'Loop through all the allowed extensions and see if the file has one blnExtensionOK = fileExtension(strNewFileName, saryFileUploadTypes) 'Create the file system object Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Check if file exsists blnFileExists = objFSO.FileExists(Server.MapPath(strUploadFilePath) & "\" & strNewFileName) 'Drop FSO as no longer needed Set objFSO = Nothing
'If the file is OK save it to disk If lngErrorFileSize = 0 AND blnExtensionOK AND blnFileExists = False Then ' Save the binary data to the file system objUpload("file").SaveAs Server.MapPath(strUploadFilePath) & "\" & strNewFileName
'Pass the filename back fileUpload = strNewFileName End If Set objField = Nothing ' Release upload object from memory Set objUpload = Nothing
|