Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Pure ASP Upload
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Pure ASP Upload

 Post Reply Post Reply
Author
purna View Drop Down
Newbie
Newbie


Joined: 06 August 2013
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote purna Quote  Post ReplyReply Direct Link To This Post Topic: Pure ASP Upload
    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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.