|
Gianluigi,
The Upload and Insert Record behaviour has stopped working correctly. One of the fields (a DATE field is not being inserted into the database record. I have created a test version of the process.
Source code is here.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#include file="Connections/cnMySQL1.asp" --> <!--#include file="dwzUpload/DefineVariable.asp" --> <% '********************************* '* * '* INSERT RECORD AND UPLOAD * '* http://www.DwZone-it.com * '* * '********************************* server.ScriptTimeout = 5400
Dim RG_altVal, RG_columns, RG_Cong, RG_dbValues, RG_dbValuesTmp, RG_delim, RG_editCmd, RG_editQuery, RG_editQueryTmp, RG_emptyVal, RG_Ext, RG_Extensions, RG_fields, RG_FieldValueTmp, RG_FileDel, RG_FileExt, RG_formVal, RG_FS, RG_i, RG_L, RG_Len, RG_Max, RG_Name, RG_New, RG_newName, RG_Num, RG_Path, RG_Rec, RG_ret, RG_Save, RG_tableValues, RG_tableValuesTmp, RG_tst, RG_typeArray, RG_z, UploadStatus, NumFile Dim RG_Connection, RG_editColumn, RG_recordId, Form, editAction, editRedirectUrl, RG_Files, RG_formName, UploadType, ParamVal, ParamList, MaxFieldNumber, TmpVal, x, y, Key, ProgressBar, newFileName Dim tmpField_Name(), tmpValue_Name(), tmpField_Size(), tmpValue_Size(), tmpField_Thumb(), tmpValue_Thumb(), QtyRecord, TotalFileSize, valueToRedirectSend Set Form = New ASPForm Dim UploadID UploadID = Form.NewUploadID ProgressBar = "" TotalFileSize = "" editRedirectUrl = "treasurer.asp" RG_Connection = MM_cnMySQL1_STRING RG_editTable = "SVNC.PetanqueDocuments" RG_Files = "/Documents/Treasurer;1;;;;0;DocumentFileName;1;;;;0;;;;;1;;1;fmFile@_@_@1@_@_@0@_@_@0;;;80;0;;;80;0;_small;0;0;0;;;80;0;_small;0@_@_@./@_@_@POST" RG_formName = "form1" UploadType="Insert" UploadStatus = "" valueToRedirectSend = "" NumFile = 0
if len(Request.QueryString("UploadID"))>0 then Form.UploadID = Request.QueryString("UploadID") end if if (Request.QueryString <> "") Then editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) & "?" & Request.QueryString & "&UploadID=" & UploadID else editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) & "?UploadID=" & UploadID End If Const fsCompletted = 0
If Form.State = fsCompletted Then if Form.State = 0 then
Set ParamVal = CreateObject("Scripting.Dictionary") tmp = split(RG_Files,"@_@_@") ParamList = split(tmp(0),"|") MaxFieldNumber = ubound(ParamList) for x=0 to Ubound(ParamList) TmpVal = Split(ParamList(x),";") for y=0 to ubound(TmpVal) Key = right("00" & cstr(x),3) & cstr(y) ParamVal.add Key, TmpVal(y) next next Form.Files.Save
RG_fieldsStr = "fmDocumentCaption|value|fmDocumentCategory|value|fmDocumentDate|value" RG_columnsStr = "DocumentCaption|',none,''|DocumentCategory|',none,''|DocumentDate|',none,NULL" Form.Files.DataBaseInsert
response.write(getRedirect()) response.end End If ElseIf Form.State > 10 then response.write "<br><Font Color=red>Some form error.<br>Error code: " & Form.State & "<br>Error List:<br>0 Form was successfully processed. <br>1 Request method is NOT post <br>2 Zero length request (there are no data in a source form) <br>3 Form is in a middle of process. <br>5 Initial form state <br>11 Boundary of multipart/form-data is not specified. <br>12 Unknown source form (Content-type must be multipart/form-data) <br>15 Client was disconnected before upload was completted.<br>16 Unexpected error from Request.BinaryRead method (ASP error).<br></Font><br>" End If
function GetFolderName(str): GetFolderName = Ris : end function
function myGetFileName(str): myGetFileName = Ris : end function
%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head>
<body> <form onsubmit="return ProgressBar()" action="<%=editAction%>" method="post" enctype="multipart/form-data" name="form1" id="form1"> <p> <input type="text" name="fmDocumentCaption" id="fmDocumentCaption" /> Document Caption</p> <p> <input type="text" name="fmDocumentCategory" id="fmDocumentCategory" /> Document Category</p> <p> <input type="text" name="fmDocumentDate" id="fmDocumentDate" /> DocumentDate</p> <p> <input name="fmFile" type="file" id="fmFile" onchange="dwz_setEvent(this,'change')" onclick="dwz_setEvent(this,'click')" /> </p> <p>Upload <input type="submit" name="fmUpload" id="fmUpload" value="Submit" /> </p> <p> </p> </form> </body> </html> <!--#include file="dwzUpload/Upload.asp" --> <!--#include file="dwzUpload/UploadAdvanced.asp" --> <!--#include file="dwzUpload/Resize.asp" -->
|
|
|
|
|