it won't work client-side because ASP/ASP.Net are server-side frameworks and
files
utilising the code below must have a .asp or .aspx extension.
All files with .html extension are client-side.
The only way to batch copy from client to server is to upload them from a
form. If you are
just copying or moving files on the server, then you can use
Scripting.FileSystem or the .Net
classes to achieve your goal.
If you're uploading files from client to server you must use
the enctype="multipart/form-data" attribute in the <form> tag, then write
out
to the page however many file input boxes you need. eg,
<form name="upload" enctype="multipart/form-data">
<input type="file" name="file1">
<input type="file" name="file2">
</form>
etc. Create the maximum of these you'll ever need......
The form part can be in a static html file but if you want to do any sort of
ASP.Net forms
validation, it should be in a .aspx file with runat="server" as a <form> tag
attribute.
The form code that does the uploading could then loop through as many of the
fields that were
populated (eg 'for each item in'...) and upload them accordingly using
UploadFile.PostedFile.SaveAs()
Phil
-----Original Message-----
From: charles.lam@g... [mailto:charles.lam@g...]
Sent: 20 March 2002 12:04
To: ASPX_Professional
Cc: ASPX_Professional
Subject: [aspx_professional] RE: Scripting.FileSystemObject
Philip Steel
<PhilipS@t... To: "ASPX_Professional"
<aspx_professional@p...>
uk.com> cc:
Subject: [aspx_professional]
RE: Scripting.FileSystemObject
03/20/2002 07:17
PM
Please respond to
"ASPX_Professiona
l"
Thanks ! Phil,
I actually have a HTML file which is Automatically Generate by Microsoft
Word...(HTML generator by Microsoft Word)
they are
[Client Machine]
c:\my document\doc1.html
c:\my document\doc1_files\images001.jpg
\images002.jpg
\filelist.xml
\image003.wmz
\image004.gif
I don't wanted to upload those files one by one ... I would like to write
some backend logic in the aspx file
my idea is I only choose doc1.html file and which can scan through all the
files within the doc1_files directory and
automatically send those files by batch...
uploading files from client side to server side without creating mutiple
file control ... as I don't know how many
file I have to upload to the server each time ...
P.S. your program it working on the Server Side ... but not Client Side ...
Thanks !
Cheers,
charles.
But I would like to browse this aspx file on the server side and check
against with the client side's harddrive...
Hi Charles
You can use the System.IO Namespace for this sort of thing, for example
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<%
If Directory.Exists("C:") Then
Response.write ("C: exists.")
Else
Response.write ("C: does not exist.")
End If
%>
But you can still instantiate ASP intrinsic objects from ASP.Net: from a
performance standpoint
it's not recommended to do this though. If you're building a dot net app,
it's better to take
from the dot net class library.
For more info, check out the System.IO Namespace in the .Net Framework
documentation.
Hope this helps
Phil
-----Original Message-----
From: charles.lam@g... [mailto:charles.lam@g...]
Sent: 20 March 2002 10:52
To: ASPX_Professional
Subject: [aspx_professional] Scripting.FileSystemObject
Hi All,
Is that Possible to use Scripting.FileSystemObject in aspx file ?
Since I would like to do some client side scripting to check the content of
client's local machine.
Is that possible to doing this kinds of work on asp .net ?
<html>
<script language ="vb" runat="server">
Function ReportDriveStatus(drv)
Dim fso, msg
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.DriveExists(drv) Then
msg = ("Drive " & UCase(drv) & " exists.")
Else
msg = ("Drive " & UCase(drv) & " doesn't exist.")
End If
ReportDriveStatus = msg
End Function
</script>
..
..
</html>
Thanks !
Charles.
This e-mail (and any attachment (s)) is confidential and for use only by
intended recipient (s). Access by others is unauthorised. Its content
should not be relied upon and no liability or responsibility is accepted by
us, without our subsequent written confirmation of its content. If you are
not an intended recipient, please notify us promptly and delete all copies
and note that any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on the information it contains is
prohibited and may be unlawful. Further information on Guoco Group is
available from http://www.guoco.com
This e-mail (and any attachment (s)) is confidential and for use only by
intended recipient (s). Access by others is unauthorised. Its content
should not be relied upon and no liability or responsibility is accepted by
us, without our subsequent written confirmation of its content. If you are
not an intended recipient, please notify us promptly and delete all copies
and note that any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on the information it contains is
prohibited and may be unlawful. Further information on Guoco Group is
available from http://www.guoco.com