Recently I just bought your Pure Asp Upload. Im trying to get the upload form to work and for some reason it wont. When I set the enctype = "multipart/form-data" it doesnt submit anything to the database. It basically submits its to itself and the form erases whatever was in the text boxes. When I take the "multipart/form-data" off, everything in the insert form but the picture uploads. What is the "multipart/form-data" problem?
Thanks,
Matthew
Here is my code, it is kind of long. Thanks again for the help.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'*** Pure ASP File Upload 2.1.9
Dim GP_uploadAction,UploadQueryString
PureUploadSetup
If (CStr(Request.QueryString("GP_upload")) <> "") Then
Dim pau_thePath,pau_Extensions,pau_Form,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout,pau_progressBar,pau_progressWidth,pau_progressHeight
pau_thePath = """Images"""
pau_Extensions = "GIF,JPG,JPEG,BMP,PNG"
pau_Form = "form2"
pau_Redirect = ""
pau_storeType = "path"
pau_sizeLimit = "1024"
pau_nameConflict = "uniq"
pau_requireUpload = "false"
pau_minWidth = ""
pau_minHeight = ""
pau_maxWidth = ""
pau_maxHeight = ""
pau_saveWidth = ""
pau_saveHeight = ""
pau_timeout = "600"
pau_progressBar = ""
pau_progressWidth = "300"
pau_progressHeight = "100"
Dim RequestBin, UploadRequest
CheckPureUploadVersion 2.19
ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout
end if
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="members.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "form2") Then
MM_editConnection = MM_snsdatabase_STRING
MM_editTable = "dbo.Items"
MM_editRedirectUrl = "nowinserted.asp"
MM_fieldsStr = "name|value|points|value|maincategory|value|sub|value|description|value|item_picture|value|sellerid|value|email|value"
MM_columnsStr = "item_name|',none,''|item_price|',none,''|main_category|',none,''|categories|',none,''|item_description|',none,''|item_picture|',none,''|seller_ID|',none,''|email|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim RsUpload__MMColParam
RsUpload__MMColParam = "1"
If (Request.BinaryRead("item#") <> "") Then
RsUpload__MMColParam = Request.BinaryRead("item#")
End If
%>
<%
Dim RsUpload
Dim RsUpload_numRows
Set RsUpload = Server.CreateObject("ADODB.Recordset")
RsUpload.ActiveConnection = MM_snsdatabase_STRING
RsUpload.Source = "SELECT * FROM dbo.Items WHERE item# = " + Replace(RsUpload__MMColParam, "'", "''") + ""
RsUpload.CursorType = 0
RsUpload.CursorLocation = 2
RsUpload.LockType = 1
RsUpload.Open()
RsUpload_numRows = 0
%>
SwapnSwitch - Add an Item
<%
RsUpload.Close()
Set RsUpload = Nothing
%>
Comments
Use The Forum
For troubleshooting help like this, you need to use the 'Forum'...
Same problem
Hi...
I have the same problem and i was trying to know more about it, and i found this:
First, this problem occure when i use a recordset object but if i insert the data with a simple sql with the conn.execute function evreything run normaly, but i have to use the recordset because the entry may content special charecter and i can't create a new function to replace all the special charecter because i don't know them all, (and its a stupid methode).
the second thing i noticed that all fields in an access database run perfectly except the memo type filed it remain empty, example:
i have a table users in access with 2 fields, the first one its type is text and the second is memo.
and i added new record to the table using recordset method:
rs1.addnew
rs1("textField") = upload.form("alo")
rs1("memoField") = upload.form("how")
rs1.update
the result will be:
the text field will optain the new data
but the memo field will remain empty
can any one help???
Thanks in advance
You must me logged in to write a comment.