Sun
ONE Active Server Pages Product Home Page Developer Site Version
 

ContentsPreviousNextIndex



Chili!Upload Methods Examples


The following script uploads a file:

<FORM ACTION="fileupld.asp" METHOD="POST" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE">
<INPUT TYPE="SUBMIT" VALUE="Send">
</FORM>

The following fileupld.asp script processes the upload:

<%
Response.Expires = 0
Set fbase = Server.CreateObject("Chili.Upload.1")
fbase.SizeLimit = 10000
fbase.SaveToFile("/opt/datafiles/test.dat")
%>
Done writing <%=fbase.FileSize%> bytes from user file <%=fbase.SourceFileName%>
(of type <%=fbase.SourceFileExtension%>)

In a shared Web hosting environment, such as with an Internet Service Provider, you might not know the directory structure above the document root for your virtual host. In this situation, you cannot specify an absolute path name for the file, so you must use the Server.MapPath directive instead. The following example illustrates saving the uploaded file to the document root of the virtual host:

<%
Response.Expires = 0
Set fbase = Server.CreateObject("Chili.Upload.1")
fbase.SizeLimit = 10000
fbase.SaveToFile(Server.mapPath("/") & "/" & "test.dat")
%>
Done writing <%=fbase.FileSize%> bytes from user file
<%=fbase.SourceFileName%> (of type <%=fbase.SourceFileExtension%>)



ContentsPreviousNextIndex