1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
<%
' Variables
' *********
Dim mySmartUpload
Dim intCount
Dim Conn
Dim SQL
Dim Rs
Dim file
Dim thenum
Dim i
Dim thenom
Dim theprenom
Dim theemail
Dim thenomarticle
Set conn = Server.CreateObject("ADODB.Connection")
connstring="DRIVER={Microsoft Access Driver (*.mdb)}; " & "DBQ=" & Server.MapPath(".") & "/../admin/ems07.mdb"
conn.Open connstring
sql = "SELECT * from upload "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 1, 3
'On Error Resume Next
Set mySmartUpload = Server.CreateObject("Persits.Upload.1")
mySmartUpload.SetMaxSize 2000000, True
mySmartUpload.IgnoreNoPost = True
mySmartUpload.SaveVirtual "../Upload/"
if instr(mySmartUpload.Form("emaildepositaire"),"@")=0 or instr(mySmartUpload.Form("emaildepositaire"),".")=0 then response.redirect "revuenewems.asp?email=bad" end if
if mySmartUpload.Form("nomarticle")="" or mySmartUpload.Form("genredepositaire")="" or mySmartUpload.Form("nomdepositaire")="" or mySmartUpload.Form("prenomdepositaire")="" or mySmartUpload.Form("adressedepositaire")="" or mySmartUpload.Form("cpdepositaire")="" or mySmartUpload.Form("villedepositaire")="" or mySmartUpload.Form("paysdepositaire")="" or mySmartUpload.Form("teldepositaire")="" or mySmartUpload.Form("orgadepositaire")="" or mySmartUpload.Form("emaildepositaire")="" or mySmartUpload.Form("nomdepositaire")="" or mySmartUpload.Form("prenomdepositaire")="" or mySmartUpload.Form("presentation")="" then response.redirect "revuenewems.asp?valid=bad" end if
'Set File = mySmartUpload.Files("fichier")
'Set File = Upload.Files("FILE1")
For Each toto in mySmartUpload.Files
thenomarticle = mySmartUpload.Form("nomarticle")
thenom = mySmartUpload.form("nomdepositaire")
theprenom = mySmartUpload.form("prenomdepositaire")
theemail = trim(mySmartUpload.Form("emaildepositaire"))
up = toto.FileName
nomfichier = thenom&"_"&day(date)&"_"&month(date)&"_"&year(date)&toto.Ext
'File.FileName = nomfichier
'For each file In File1
rs.addnew
num = rs.fields("num")
'file.FileToField Rs.Fields("fichier")
Rs.fields("fichier") = nomfichier
Rs.fields("taille") = toto.Size
rs.fields("nomarticle")=mySmartUpload.Form("nomarticle")
rs.fields("genredepositaire")=mySmartUpload.Form("genredepositaire")
rs.fields("nomdepositaire")=mySmartUpload.Form("nomdepositaire")
rs.fields("prenomdepositaire")=mySmartUpload.Form("prenomdepositaire")
rs.fields("adressedepositaire")=mySmartUpload.Form("adressedepositaire")
rs.fields("cpdepositaire")=mySmartUpload.Form("cpdepositaire")
rs.fields("villedepositaire")=mySmartUpload.Form("villedepositaire")
rs.fields("paysdepositaire")=mySmartUpload.Form("paysdepositaire")
rs.fields("teldepositaire")=mySmartUpload.Form("teldepositaire")
rs.fields("faxdepositaire")=mySmartUpload.Form("faxdepositaire")
rs.fields("orgadepositaire")=mySmartUpload.Form("orgadepositaire")
rs.fields("labodepositaire")=mySmartUpload.Form("labodepositaire")
rs.fields("emaildepositaire")=mySmartUpload.Form("emaildepositaire")
rs.fields("login")=mySmartUpload.Form("nomdepositaire")
rs.fields("password")=mySmartUpload.Form("prenomdepositaire")
rs.fields("presentation")=mySmartUpload.Form("presentation")
rs.fields("classementthematique")=mySmartUpload.Form("classementthematique")
rs.fields("version")="1"
rs.fields("datearticle")=date()
rs.fields("publicationrevue")="non"
thelog = mySmartUpload.Form("login")
thepass = mySmartUpload.Form("password")
rs.update
Next
If Err Then
Response.Write("<b>Erreur : </b><br>This file is not a text format file or the size of your file exceeds the authorized size (2Mo)<br> Clic on Back in your browser")
else
' Fermeture de l'objet rs
rs.close
set rs=nothing
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.Open sql, conn, 3, 3
rs1.movelast
thenum = rs1("num")
fichiermodif = thenum&"_"&nomfichier
SQL = "UPDATE upload SET fichier='"&fichiermodif
SQL= SQL & "' WHERE num = " & thenum
set myRCset = conn.Execute (SQL,nb,1)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
dir = Server.MapPath("../")
set filePt = FSO.getFile(dir &"\Upload\" & up)
filePt.Move dir &"\Upload\" & fichiermodif
session("nomfichier")=fichiermodif
session("thenom")=thenom
session("theprenom")=theprenom
session("emaildepositaire")=theemail
session("thenomarticle")=thenomarticle
response.redirect ("revuemailemsUS.asp")
end if
%> |
Partager