Voila aprés avoir galéré sur le net à chercher un code source pour l'upload et l'affichage d'images d'un folder ,j'ai enfin fini par trouver et adapter à ma sauce un truc sympathoche .
Bon niveau design c'est pas top , mais au moin ça fonctionne aprés pour le reste ...
Alors je vous met mon code en espérant eviter des prises de tete à certaines personnes
l'upload : envpics.asp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Envoyer des images vers la base</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <% '------------------------------------------------------------ Public sub UploaderFichier(mySmartUpload, strAdresse) '------------------------------------------------------------ '--- upload fichier a une adresse donne '------------------------------------------------------------ Dim Fichier Dim strAdr On error resume next'si erreur on continue quand meme 'mySmartUpload.MaxFileSize = 100000' Taille maximale autorise : 100Ko 'mySmartUpload.AllowedFilesList = "gif,jpg"' Upload autoris sur les gif et jpg uniquement mySmartUpload.Upload' Selectionne chaque fichier For each Fichier In mySmartUpload.files If not Fichier.IsMissing Then strAdr=strAdresse & Fichier.FileName Fichier.SaveAs(strAdr)' Upload du fichier End If Next if err.number =0 then 'test si erreur direc= "<img src="""& strAdr & """><br>"'si pas erreur alors on affichera l'image dl else direc="une erreur c produite : "& strAdr &"<br>"'si erreur alors on affiche l'erreur end if response.Write(direc) End sub if request.queryString("Action")="Upload" then response.expires=0 'a je sais pas response.buffer=true'a je sais pas non plus On error resume next' Grer les erreur ' Variables Dim mySmartUpload 'ce qui permet d'up le fichier Dim strAdr 'Adresse du fichier Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")' Cration de l'Objet strAdr=Server.MapPath("c:/base/picsbase")' changer pour installer ou vous le voulez '--- Upload les fichiers l'adresse strAdr UploaderFichier mySmartUpload, strAdr set mySmartUpload=nothing'Si aucune erreur s'est produite on redirige vers uploadok.asp End if %> <form method="POST" action="envpics.asp?action=Upload" enctype="multipart/form-data"> <input type="file" name="Fichier1" size="20"><br> <input type="submit" value="uploader" name="action"> </form> </body> </html>
Affichage des photos en diaporama : dvvv.asp
par contre ci vous avez une idée pour l 'améliorer je suis prenneur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!---------------------------------------------------------------------------- -----------------------------------------------------------------------------> <% dim table, index ' Changer le premier chiffre de table(X,2) pour le nombre de photos que vous voulez afficher redim table(6,2) ' Entrer chaque photo dans la table. Premirement le nom de la photo et deuximent un titre table(0,0) = "vvv1.jpg" table(0,1) = "111111" table(1,0) = "vvv2.jpg" table(1,1) = "222222" table(2,0) = "vvv3.jpg" table(2,1) = "333333" table(3,0) = "vvv4.jpg" table(3,1) = "4444444" table(4,0) = "vvv5.jpg" table(4,1) = "4444444" table(5,0) = "vvv6.jpg" table(5,1) = "4444444" if request.querystring("index") <> "" then index = int(request.querystring("index")) else index = 0 end if %> <html> <head> <title>TITRE</title> </head> <body link="#000000" vlink="#000000" alink="#000000"> <center> <table width="780"> <tr> <td> <font face="Arial" size="2"> <center> <font size="5" face="arial"<b>TITRE</font></b><br> <%if index <> 0 then%> <a href="../../picsbase/phcampings/dvvv.asp?index=<%=index-1%>"><-- Arrire</a> <%end if%> <b>|</b> <%if index < ubound(table)-1 then%> <a href="../../picsbase/phcampings/dvvv.asp?index=<%=index+1%>">Avant --></a> <%end if%> </td> </tr> <tr> <td> <center> <font size="4" face="arial"> <%=table(index,1)%> </font> <center><img src="/picsbase/phcampings/<%=table(index,0)%>"> </td> </tr> </table> </body> </html>
Du genre la création un folder à chaque upload pour ne pas melanger les album et l'affichage en mini en dessous du diaporama cliquable en fonction de l'album ( folder )![]()
Partager