codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'*********************************
'* *
'* INSERT RECORD AND UPLOAD *
'* http://www.dwzone.it *
'* *
'*********************************
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
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 = "insertOk.asp"
RG_Connection = MM_connUploadSuNasi_STRING
RG_editTable = "tblFiles"
RG_Files = "/files/;1;;;;0;file;1;dimensione&S;;;0;;;;;;file@_@_@1@_@_@ @_@_@@_@_@./"
RG_formName = "modUpload"
UploadType="Insert"
UploadStatus = ""
valueToRedirectSend = "nomeFile"
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 = "nomeFile|value"
RG_columnsStr = "descrizione|',none,''"
Form.Files.DataBaseInsert
response.write(getRedirect())
response.end
End If
ElseIf Form.State > 10 then
response.write "
<Font Color=red>Some form error.
Error code: " & Form.State & "
Error List:
0 Form was successfully processed.
1 Request method is NOT post
2 Zero length request (there are no data in a source form)
3 Form is in a middle of process.
5 Initial form state
11 Boundary of multipart/form-data is not specified.
12 Unknown source form (Content-type must be multipart/form-data)
15 Client was disconnected before upload was completted.
16 Unexpected error from Request.BinaryRead method (ASP error).
</Font>
"
End If
function GetFolderName(str): GetFolderName = Ris : end function
function myGetFileName(str): myGetFileName = Ris : end function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento senza titolo</title>
</head>
<body>
<form onsubmit="return ProgressBar()" action="<%=editAction%>" method="post" enctype="multipart/form-data" name="modUpload" id="modUpload">
descrizione file
<input name="nomeFile" type="text" id="nomeFile">
</p>
<input type="file" name="file">
</p>
<input type="submit" name="Submit" value="Invia">
</p>
</form>
</body>
</html>
grazie!!