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
|
<%
if Request.Form("nompdf")<>"" then
session("nompdf") = Request.Form("nompdf")
else
session("nompdf") = ""
end if
%>
<link href="upload.css" rel="stylesheet" type="text/css">
<form method="POST" enctype="multipart/form-data" action="" class="actu2">
<span class="txt-noir-gras">Insérer un fichier PDF :</span><br>
<input type="file" name="FICHIER1" class="champ2" id="pdf" size="50"><br>
<input type="submit" name="action" value="Uploader le PDF" class="bouton">
</form>
<br /><br />
<% ' TRAITEMENT du formulaire
' --------------------------------------------------------------------------------------
' CREATION de l objet
on error resume next
set MonUPLOAD = Server.CreateObject("aspSmartUpload.SmartUpload")
' --------------------------------------------------------------------------------------
' Placez ICI les PROPRIETES ou RESTRICTIONS eventuelles pour les fichiers
'MonUPLOAD.TotalMaxFileSize = 2000000000 ' (1000ko max total)
'MonUPLOAD.MaxFileSize = 2000000000 ' (500ko max par fichier)
MonUPLOAD.AllowedFilesList = "pdf" ' (ici : images uniquement)
MonUPLOAD.DeniedFilesList = "bat,exe,com,asp,php,txt,doc,xls"
' ...
' --------------------------------------------------------------------------------------
' UPLOAD du formulaire
MonUPLOAD.Upload
' --------------------------------------------------------------------------------------
On error goto 0
' gestion des ERREURS
if (err<> 0 and err<>9) then
' affichage d'une alerte en cas d erreur (restrictions imposees)
response.write "erreur ! " & err.description
' Fermeture de l objet :
set MonUPLOAD = Nothing
' Si pas d'erreur, on continue le traitement
elseif err<>9 then
' --------------------------------------------------------------------------------------
' chemin vers le dossier MESFICHIERS
' pour enregistrer les fichiers uploades (dossier deprotege = chmod 777)
' (fonction desactivee ici)
cheminlong = Server.MapPath("..\pdf") & "\"
response.write cheminlong & "<br />"
%>
<br />
<br />
<b>Les DONNEES : (<%= MonUPLOAD.Form.Count %>)</b><br />
<br />
<%
' --------------------------------------------------------------------------------------
' traitement des DONNEES
' --------------------------------------------------------------------------------------
i=1
while ( i <= MonUPLOAD.Form.Count )
response.write "Name : " & MonUPLOAD.Form(i).Name & " - "
response.write "Values : " & MonUPLOAD.Form(i).Values & "<br />"
i = i + 1
wend
%>
<br />
<b>Les FICHIERS : (<%= MonUPLOAD.Files.Count %>)</b><br />
TotalBytes : <%= MonUPLOAD.Files.TotalBytes %><br />
<br />
<%
' --------------------------------------------------------------------------------------
' Traitement des FICHIERS
' --------------------------------------------------------------------------------------
for each Fichier in MonUPLOAD.Files
if not fichier.IsMissing then ' seulement si le champ a ete renseigne
response.write "Name : " & Fichier.Name & "<br />"
response.write "FileName : " & Fichier.FileName & "<br />"
response.write "FileExt : " & Fichier.FileExt & "<br />"
response.write "FilePathName : " & Fichier.FilePathName & "<br />"
response.write "ContentType : " & Fichier.ContentType & "<br />"
response.write "ContentDisp : " & Fichier.ContentDisp & "<br />"
response.write "Size : " & Fichier.Size & "<br />"
response.write "TypeMIME : " & Fichier.TypeMIME & "<br />"
response.write "SubTypeMIME : " & Fichier.SubTypeMIME & "<br />"
response.write "IsMissing : " & Fichier.IsMissing & "<br />"
'response.write "BinaryData : " & Fichier.BinaryData & "<br /><br />"
' -----------------------------------------
' enregistrement dans le dossier MESFICHIERS
' (fonction desactivee ici)
Fichier.SaveAs cheminlong & Fichier.FileName
end if
next
' --------------------------------------------------------------------------------------
' Fermeture de l objet :
set MonUPLOAD = Nothing
' --------------------------------------------------------------------------------------
end if ' fin si pas d'erreur
%> |
Partager