<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Set FSO = Server.CreateObject("Scripting.FileSystemObject") If FSO.FolderExists(Application("FinalFolderUF")) = false Then FSO.CreateFolder(Application("FinalFolderUF")) End If If FSO.FolderExists(Application("FinalFolderUF")&"/"&Request("TEXT")&"/") = false Then FSO.CreateFolder(Application("FinalFolderUF")&"/"&Request("TEXT")&"/") End If dir = Application("FinalFolderUF")&"/"&Request("TEXT")&"/" set fold = FSO.GetFolder(dir) set fc = fold.Files Function AlmostUniqueID() Randomize for iCtr = 1 to 10 sChar = Chr(Int((90 - 65 + 1) * Rnd) + 65) sID = sID & sChar Next sID = sID & Month(Now) & Day(Now) & Year(Now) & Hour(Now) & Minute(Now) & Second(Now) AlmostUniqueID = sID End Function If Request("UniqueID") <> "" Then UniqueID = Request("UniqueID") Else UniqueID=AlmostUniqueID End If %> <% If Request("Action") = "INS" Then 'Stan : insertion des pièces jointes dans la bdd Set db = Server.CreateObject("ADODB.Connection") db.Open MM_CENTRALE_PRODUITS_STRING folder = Application("TempFolder") & "\" & UniqueID set fs1=Server.CreateObject("Scripting.FileSystemObject") if fs1.FolderExists(folder) = true then destinationFinale= Application("FinalFolderUF") & "\" & Request("TEXT") & "\" Set objFolder = fs1.GetFolder(folder) Set objFolderContents = objFolder.Files For Each objFile in objFolder.Files If fs1.FolderExists(destinationFinale) = false Then fs1.CreateFolder(destinationFinale) End If fileSize=objFile.Size fileName= objFile.Name sFicSource = fileName sHorodatage = "_" & Replace(Date(),"/","") & Replace(Time(),":","") sExtension = "." & fs1.GetExtensionName(fileName) sFicSourceSsExt = Epuration(Replace(sFicSource,sExtension,"")) If fs1.FileExists(destinationFinale & sFicSourceSsExt & sExtension) = true Then sFicCible = sFicSourceSsExt & sHorodatage & sExtension Else sFicCible = sFicSourceSsExt & sExtension End If fs1.MoveFile folder & "\" & sFicSource ,destinationFinale & sFicCible 'fs1.MoveFile folder & "\" & objFile.Name ,destinationFinale strSQL = "INSERT INTO dbo.FilesUpload (DocID, Fichier, Commentaires, DateUpload, Taille, TailleX, TailleY) " & _ " VALUES ('"&Request("ID")&"', '"&sFicCible &"', '"&Request("TEXT")&"', '"&Now()&"', '"&fileSize&"', '0', '0') " Response.Write(strSQL)&"
" db.Execute(strSQL) Next fs1.DeleteFolder(folder) Set objFolder = Nothing Set objFolderContents = Nothing Set fs1 = Nothing end if db.Close Set db=Nothing Response.Redirect("DocumentsCP.asp?ID="&Request("ID")&"&TEXT="&Request("TEXT")&"") End If If Request("Fichier") <> "" Then set DEL_FICHIER = Server.CreateObject("ADODB.Command") DEL_FICHIER.ActiveConnection = MM_CENTRALE_PRODUITS_STRING DEL_FICHIER.CommandText = "DELETE FROM dbo.FilesUpload WHERE Fichier = '"&Request("Fichier")&"' and DocID = '"&Request("DocID")&"' and Commentaires = '"&Request("Commentaires")&"'" DEL_FICHIER.CommandType = 1 DEL_FICHIER.CommandTimeout = 0 DEL_FICHIER.Prepared = true DEL_FICHIER.Execute() Dim myFSO 'this line creates an instance of the File Scripting Object named myFSO SET myFSO = Server.CreateObject("Scripting.FileSystemObject") 'error handling here to make sure that things go smoothly 'if the file does not exist 'Response.Write(Application("FinalFolderUF")&Request("TEXT")&"\"&Request("Fichier")&"")&"
" If myFSO.FileExists(Application("FinalFolderUF")&Request("TEXT")&"\"&Request("Fichier")&"") Then 'then we delete it myFSO.DeleteFile(Application("FinalFolderUF")&Request("TEXT")&"\"&Request("Fichier")&"") Else 'otherwise we tell the client it does so they don't get a nasty error Response.Write "Ce fichier a été supprimé" End If 'this line destroys the instance of the File Scripting Object named myFSO SET myFSO = NOTHING %> <% End If %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 DOC_numRows = DOC_numRows + Repeat1__numRows %> Gestion des pièces jointes
Gestion des Photos
Glissez & Déposez vos fichiers ici
-ou-
" /> " />
<% for each f in fc Set DOC = Server.CreateObject("ADODB.Recordset") DOC.ActiveConnection = MM_CENTRALE_PRODUITS_STRING DOC.Source = "SELECT * FROM dbo.FilesUpload WHERE Fichier = '"&f.name&"' AND DocID = '"&Fn_NoSqlInject(Request("ID"))&"' AND Commentaires = '"&Fn_NoSqlInject(Request("TEXT"))&"' " DOC.Open() If DOC.BOF And DOC.EOF Then %> <% Else %> <% End If DOC.Close() Set DOC = Nothing next %>
ID
Fichier
Taille
Date
 
  " target="_blank"><%=f.name%> <%=FormatNumber(f.size/1024,2)%> Ko
<%=f.dateCreated%>
<%=(DOC.Fields.Item("ID").Value)%>
" target="_blank"><%=(DOC.Fields.Item("Fichier").Value)%> <%=FormatNumber((DOC.Fields.Item("Taille").Value)/1024,2)%> Ko <% If DOC("TailleX") > 0 Then %>(<%=(DOC.Fields.Item("TailleX").Value)%>*<%=(DOC.Fields.Item("TailleY").Value)%> pixels)<% End If %>
<%=(DOC.Fields.Item("DateUpload").Value)%>
Fermer la fenêtre