Print Page | Close Window

Pure ASP Upload

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=30813
Printed Date: 30 March 2026 at 12:09pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Pure ASP Upload
Posted By: purna
Subject: Pure ASP Upload
Date Posted: 06 August 2013 at 11:13am
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




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net