p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: Uploading a file


Message #1 by "Phil Perks" <philp@w...> on Fri, 2 Jun 2000 9:56:49
-----Original Message-----
From: Edward L Garst [mailto:Edward_L_Garst@N...]
Sent: 01 June 2000 16:09
To: Support@w...
Subject: Uploading a file


     I have the Active Server Page 3.0 book and it is great.  I'm trying to 
save
a file to the server, but I am having some trouble.  Could you assist me 
in
saving this file.  How do I process the file through the Request object so 
that
I can use the FileSystem Object?  Thanks for your help!!


Code


ASP1.asp
 <form method="post" ENCTYPE"multipart/form-data" action="ASP2.asp" 
id="form1"
name="form1">
<p><input id="text" type="file" name="xlsfile"></p>
<p><input id="submit1" name="submit1" type="submit" value="Submit"></p>



ASP2.asp

y = Request.TotalBytes
z = Request.BinaryRead(z)

set fs = server.CreateObject("Scripting.FileSystemObject")
set f = fs.GetFile(strfile)
s = "Created: " & f.datecreated
dim writethis, pathandfilename
writethis = "test"
pathandfilename = "c:\inetpub\wwwroot\sap\ed4.csv"
set a = fs.CreateTextFile(pathandfilename,true)
a.write(writethis)
a.close

  Return to Index