Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Upload file to server using FileSystemObject


Message #1 by Hayes_Eoin@e... on Wed, 24 Apr 2002 15:19:22 -0400
I am a beginner to ASP so bear with me.
I have a simple web page, which allows the user to upload a file (of any
extension type including .img) from their computer to a fileserver. I want
to use the FileSystemObject to do this and not use any third party products.
How do I do this?I want the uploaded file to be put in a folder that is the
same as the value of the session no.

Here is my simple code so far
 


<HTML>
<head>
<TITLE>File Upload</TITLE>
</HEAD>
<body>
<center>

</form>
<form action="insert.asp" method="get" enctype="multipart/form-data"
id=form1 name=form1><BR>
<p>Please select a file to attach if desired</p>
<p><b>File: </b><input type="file" style="width: 300;" 
name="thefile"></p>
<input type="submit" value="Upload" id=submit2 name=submit2></form>

</center>

<%
Dim strfile, path, strFilename

Set fso = Server.CreateObject("Scripting.FileSystemObject")



strFilename = Session("cabSN")
path = "\\fileserver\UploadedFiles\" & strFilename & "\"


%>

</body>
</html>

Message #2 by "Joe Hughes" <JoeHughes@M...> on Wed, 24 Apr 2002 22:30:23 +0100
Hi Hayes,

You should be looking into using the ADODB.Stream object. I Believe this
article will help you;

http://www.codeproject.com/asp/aspupl.asp?print=true

also

http://www.codeproject.com/asp/uploader.asp

HTH

Joe Hughes

-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 24 April 2002 20:19
To: ASP components
Subject: [asp_components] Upload file to server using FileSystemObject


I am a beginner to ASP so bear with me.
I have a simple web page, which allows the user to upload a file (of any
extension type including .img) from their computer to a fileserver. I want
to use the FileSystemObject to do this and not use any third party products.
How do I do this?I want the uploaded file to be put in a folder that is the
same as the value of the session no.

Here is my simple code so far



<HTML>
<head>
<TITLE>File Upload</TITLE>
</HEAD>
<body>
<center>

</form>
<form action="insert.asp" method="get" enctype="multipart/form-data"
id=form1 name=form1><BR>
<p>Please select a file to attach if desired</p>
<p><b>File: </b><input type="file" style="width: 300;"
name="thefile"></p>
<input type="submit" value="Upload" id=submit2 name=submit2></form>

</center>

<%
Dim strfile, path, strFilename

Set fso = Server.CreateObject("Scripting.FileSystemObject")



strFilename = Session("cabSN")
path = "\\fileserver\UploadedFiles\" & strFilename & "\"


%>

</body>
</html>



%%email.unsub%%




  Return to Index