I've been tasked with adding file uploading to a web based application that is using Classic ASP. Unfortunately I am not allowed to use any other technology, and was told it is what it is so suggesting anything but ASP won't help in this instance.
A form POST with $.ajax is called upon submitting a simple form with some input fields and one file field, that points to a Classic ASP file that handles recordset inserts via request.form. I have added contentType: false in hopes to enctype="multipart/form-data" but been getting the following error:
Object doesn't support this property or method: 'Binary' because I changed the request.form in the insert posted below, but it won't work with request.form either. With request.form I get this error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
$.ajax({
type : 'POST',
url : 'manipulateData.asp?sqlType='+newdbTable+'&sqlRecordId='+recordId+'',
data : formData,
encode : true,
contentType : false,
success: function(data) {
// do something with data
},
error: function(data) {
console.log("ERROR" + JSON.stringify(data));
}
})
Inside the Classic ASP file manipulateData.asp is a connection string that is called inside a case statement and beneath that is more Classic ASP file for a single file upload shown below.
I was trying to implement Shadow Wizards solution but wanted to try this first as I was trying to keep things simple.
cn.execute("INSERT INTO CONTENT (contentTitle, contentContent, contentDate, categoryId, userLevel) VALUES ('" & Request.Form("contentTitle") & "','" & Request.Form("contentContent") & "','" & Request.Form("contentDate") & "','" & Request.Form("categoryTitle") & "','" & Request.Form("userLevel") & "')")
' TEST FILE UPLOAD
Dim objUpload
Dim strFile, strPath
' Instantiate Upload Class '
Set objUpload = New clsUpload
strFile = objUpload.Fields("file").FileName
strPath = server.mappath("/files") & "/" & strFile
' Save the binary data to the file system '
objUpload("file").SaveAs strPath
Set objUpload = Nothing
Is what I am attempting to do even possible as I've ready that request.form and request.binary can't be used at the same time? If not then what would be some alternatives?