KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/thomasjolly1/admin/imageuploadsystem/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/thomasjolly1/admin/imageuploadsystem/add_pro.asp
<%
'''
'''
<!--#include file="../Connections/dsPets.asp" -->
'''
'''
%>
<!-- #INCLUDE file="incImageLoader.asp" -->

<%
''' You Need This Function
''' You Need This Function
''' You Need This Function
'Strips the punctuation marks and special characters from String
Function stripPunctuation(Name)
Output = Name
Output = Replace(Output, ":", "")
Output = Replace(Output, ";", "")
Output = Replace(Output, ",", "")
Output = Replace(Output, ".", "")
Output = Replace(Output, "/", "")
Output = Replace(Output, "'", "")
Output = Replace(Output, "`", "")
Output = Replace(Output, "~", "")
Output = Replace(Output, "!", "")
Output = Replace(Output, "@", "")
Output = Replace(Output, "#", "")
Output = Replace(Output, "$", "")
Output = Replace(Output, "%", "")
Output = Replace(Output, "^", "")
Output = Replace(Output, "&", "")
Output = Replace(Output, "*", "")
Output = Replace(Output, "(", "")
Output = Replace(Output, ")", "")
Output = Replace(Output, "_", "")
Output = Replace(Output, "-", "")
Output = Replace(Output, "\", "")
Output = Replace(Output, "?", "")
Output = Replace(Output, "<", "")
Output = Replace(Output, ">", "")
Output = Replace(Output, " ", "")
stripPunctuation = Output'Return the value of Output
End Function
''' You Need This Function
''' You Need This Function
''' You Need This Function

	' load object this is required
Set load = new Loader

' calling initialize method
load.initialize

' Get All Data Fields But Not the Image Field

sample_field = load.getValue("sample_field")

sImgNew = stripPunctuation(load.getValue("sample_field")) ''' This Renames The File Name To the Sample Field Data
''' If you Don't want a name for the image instead you can use a time stamp
''' sImgNew = stripPunctuation(now)
sImgNew = "image_" & lcase(replace(sImgNew," ", "_"))
'response.write sImgNew & "<br>"


'''' All of this code transfers the file from the local computer to the server.  Continue to End Upload Number 1
'''' Start Upload Number 1
'''' Start Upload Number 1
' File binary data
fileData = load.getFileData("sImg")
' File name
fileName = LCase(load.getFileName("sImg"))
'response.write("fileName: " & fileName & "<br>")

'Set the filename
pos = InStr(fileName, ".")
fileFormat = Right(fileName, Len(fileName) - pos)
'response.write("fileFormat: " & fileFormat & "<br>")
setFileNameOne = sImgNew
'setFileNameOne = stripPunctuation(setFileNameOne)
setFileNameOne = setFileNameOne & "." & fileFormat
'response.write("setFileNameOne: " & setFileNameOne & "<br>") 
' File path

filePath = load.getFilePath("sImg")
'response.write("filePath: " & filePath & "<br>")
' File path complete

filePathComplete = load.getFilePathComplete("sImg")
'response.write("filePathComplete: " & filePathComplete & "<br>")
' File size

fileSizeOne = load.getFileSize("sImg")
'response.write("fileSize: " & fileSize & "<br>")
' File size translated

fileSizeTranslated = load.getFileSizeTranslated("sImg")
'response.write("fileSizeTranslated: " & fileSizeTranslated & "<br>")
' Content Type

contentType = load.getContentType("sImg")
'response.write("contentType: " & contentType & "<br>")
' No. of Form elements

countElements = load.Count
' Path where file will be uploaded

'''''''''''' *************************** ''''''''''''
'''''''''''' *************************** ''''''''''''
'''''''''''' *************************** ''''''''''''
''' Define the Path to the folder you want the image located
''' Uploading file data
pathToFile = Server.mapPath("/images/") & "\" & setFileNameOne
'response.write("pathToFile: " & pathToFile & "<br>")
'''''''''''' *************************** ''''''''''''
'''''''''''' *************************** ''''''''''''
'''''''''''' *************************** ''''''''''''

''' Define What File Types are allowed to upload
If (fileFormat = "jpg") or (fileFormat = "jpeg") or (fileFormat = "gif") Then

''' Define Minimum File Size to Upload and Maximum
If fileSizeOne > 250 and fileSizeOne < 200001 Then ' 200001 = 201K... This can be changed to any number
	fileUploaded = load.saveToFile("sImg", pathToFile)
Else 
	setFileNameOne = ""
End If
Else
	setFileNameOne = ""
End If
'''' End Upload Number 1
'''' End Upload Number 1
'''' End All of this code transfers the file from the local computer to the server.

''' Update Database '''
''' Update Database '''
''' Update Database '''
set rs = server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM yourtablename"
rs.Open sql, dbConn,adOpenDynamic,adLockOptimistic
rs.AddNew
''' Your Fields
rs("sample_field") = sample_field
''' End Your Fields

''' Update Image Name To Database
if fileSizeOne > 250 and (fileFormat = "jpg") or (fileFormat = "jpeg") or (fileFormat = "gif") and fileSizeOne < 200001 Then
' 200001 = 201K... This can be changed to any number
rs("image_field_in_database") = setFileNameOne
end if

rs.Update
response.redirect "index.asp"
''' Update Database '''
''' Update Database '''
''' Update Database '''
%>

Anon7 - 2021