By 14 Dicembre 2010 0 Comments

AspSmartUpload – Esempio 1: upload multiplo

Esempio 1: upload multiplo

Carica uno o più file sul server.
Il modulo HTML permette all’utente di selezionare il file (s). Il file ASP utilizza aspSmartUpload per salvare i file sul disco del server. In questo esempio, i file vengono salvati direttamente con il loro nome originale in una directory virtuale sul server web. aspSmartUpload inoltre consente di salvare i file in qualsiasi directory sul server.
il form deve essere passato nel modo ENCTYPE=”multipart/form-data”

Esempio di pagina HTML che esegue il POST :

<HTML>
<BODY BGCOLOR="white">
<H1>aspSmartUpload : Sample 1</H1><HR>
<FORM METHOD="POST" ACTION="Sample1.asp" ...
...ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE2" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE3" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE4" SIZE="50"><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM>
</BODY>
</HTML>

Esempio di pagina ASP che riceve il POST :


<HTML>
<BODY BGCOLOR="white">
<H1>aspSmartUpload : Sample 1</H1>
<HR>
<%
' Variables
' *********
Dim mySmartUpload
Dim intCount
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
' Save the files with their original names in a
' virtual path of the web server
' ****************
intCount = mySmartUpload.Save("/aspSmartUpload/Upload")
' sample with a physical path
' intCount = mySmartUpload.Save("c:temp")
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.")
%>
</BODY>


About the Author:

shared on wplocker.com