By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,780 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,780 IT Pros & Developers. It's quick & easy.

copy file from a location variable

P: n/a
Hi,

I want to copy a file from a variable location
"C:\...\myDocument\thisfile.txt" to a destination D:\data\
How can I do that? I tried to get the path from <input tyep=file>, but I
couldn't pass this value to the filesystemobject
Thanks for any idea.
--
Andrew

Jul 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Have you already uploaded the file to C:\whatever\ on the server? Or is
that location on the client?

You can't access the client's file system directly... you will need to
upload the file to the server, and if you're doing that, just save the file
to d:\data\ (how you do this depends on the component you're using).

For information on copying/moving files, see http://www.aspfaq.com/2039

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:8k********************@twister01.bloor.is.net .cable.rogers.com...
Hi,

I want to copy a file from a variable location
"C:\...\myDocument\thisfile.txt" to a destination D:\data\
How can I do that? I tried to get the path from <input tyep=file>, but I
couldn't pass this value to the filesystemobject
Thanks for any idea.
--
Andrew

Jul 19 '05 #2

P: n/a
<%
Dim strSource
Dim strDestination

strSource = Request.Form("file")
strDestination = Request.Form("destination")

Dim FSO
Dim Fl
Set FSO = CreateObject("scripting.filesystemobject")
Set Fl = FSO.MoveFile strSource, strDestination
Set FSO = Nothing
Set Fl = Nothing
Response.End
%>

<form name="MoveFile" method="post" enctype="multipart/form-data"
action="thisfile.asp">
<Input type="File" name="file">
<input type="submit" value="Move File">
</form>
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Andrew <du******@yahoo.com> wrote in message
news:8k********************@twister01.bloor.is.net .cable.rogers.com...
Hi,

I want to copy a file from a variable location
"C:\...\myDocument\thisfile.txt" to a destination D:\data\
How can I do that? I tried to get the path from <input tyep=file>, but I
couldn't pass this value to the filesystemobject
Thanks for any idea.
--
Andrew

Jul 19 '05 #3

P: n/a
> <Input type="File" name="file">
....
strSource = Request.Form("file")


This doesn't make much sense... input type = file is going to post a
binary/OLE object, not a string merely representing its path... did you try
your code?

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #4

P: n/a
hehe, apologies, it was meant to be type=text not file (I'm having a bad
hair day).

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Aaron Bertrand [MVP] <aa***@TRASHaspfaq.com> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
<Input type="File" name="file"> ...
strSource = Request.Form("file")


This doesn't make much sense... input type = file is going to post a
binary/OLE object, not a string merely representing its path... did you

try your code?

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Jul 19 '05 #5

P: n/a
Sorry, I didn't specify that I do that at the local server, so I don't have
to upload. That means C: and D: are in the same machine. This is for
convenience only
In addition, I want to know to get the value(string) of the path
"C:\...\myDocument\thisfile.txt", whose value is also from by click on the
"Browse..." button. This value can be caught after submitting the form. Any
idea?
Thanks
--
Andrew
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
Have you already uploaded the file to C:\whatever\ on the server? Or is
that location on the client?

You can't access the client's file system directly... you will need to
upload the file to the server, and if you're doing that, just save the file to d:\data\ (how you do this depends on the component you're using).

For information on copying/moving files, see http://www.aspfaq.com/2039

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:8k********************@twister01.bloor.is.net .cable.rogers.com...
Hi,

I want to copy a file from a variable location
"C:\...\myDocument\thisfile.txt" to a destination D:\data\
How can I do that? I tried to get the path from <input tyep=file>, but I
couldn't pass this value to the filesystemobject
Thanks for any idea.
--
Andrew


Jul 19 '05 #6

P: n/a
The Browse... button initiated by INPUT TYPE=FILE is for uploading a file,
not selecting the name of a file. You should create your own directory
browser with FileSystemObject for that functionality.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:Jy*********************@news04.bloor.is.net.c able.rogers.com...
Sorry, I didn't specify that I do that at the local server, so I don't have to upload. That means C: and D: are in the same machine. This is for
convenience only
In addition, I want to know to get the value(string) of the path
"C:\...\myDocument\thisfile.txt", whose value is also from by click on the
"Browse..." button. This value can be caught after submitting the form. Any idea?
Thanks
--
Andrew
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
Have you already uploaded the file to C:\whatever\ on the server? Or is
that location on the client?

You can't access the client's file system directly... you will need to
upload the file to the server, and if you're doing that, just save the

file
to d:\data\ (how you do this depends on the component you're using).

For information on copying/moving files, see http://www.aspfaq.com/2039

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:8k********************@twister01.bloor.is.net .cable.rogers.com...
Hi,

I want to copy a file from a variable location
"C:\...\myDocument\thisfile.txt" to a destination D:\data\
How can I do that? I tried to get the path from <input tyep=file>, but I couldn't pass this value to the filesystemobject
Thanks for any idea.
--
Andrew



Jul 19 '05 #7

P: n/a
How can I do that? Thanks

--
Andrew
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
The Browse... button initiated by INPUT TYPE=FILE is for uploading a file,
not selecting the name of a file. You should create your own directory
browser with FileSystemObject for that functionality.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:Jy*********************@news04.bloor.is.net.c able.rogers.com...
Sorry, I didn't specify that I do that at the local server, so I don't have
to upload. That means C: and D: are in the same machine. This is for
convenience only
In addition, I want to know to get the value(string) of the path
"C:\...\myDocument\thisfile.txt", whose value is also from by click on the
"Browse..." button. This value can be caught after submitting the form.

Any
idea?
Thanks
--
Andrew
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
Have you already uploaded the file to C:\whatever\ on the server? Or is that location on the client?

You can't access the client's file system directly... you will need to
upload the file to the server, and if you're doing that, just save the

file
to d:\data\ (how you do this depends on the component you're using).

For information on copying/moving files, see http://www.aspfaq.com/2039
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:8k********************@twister01.bloor.is.net .cable.rogers.com...
> Hi,
>
> I want to copy a file from a variable location
> "C:\...\myDocument\thisfile.txt" to a destination D:\data\
> How can I do that? I tried to get the path from <input tyep=file>,

but I > couldn't pass this value to the filesystemobject
> Thanks for any idea.
> --
> Andrew
>
>
>



Jul 19 '05 #8

P: n/a
How can I do that?

--
Andrew
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
The Browse... button initiated by INPUT TYPE=FILE is for uploading a file,
not selecting the name of a file. You should create your own directory
browser with FileSystemObject for that functionality.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:Jy*********************@news04.bloor.is.net.c able.rogers.com...
Sorry, I didn't specify that I do that at the local server, so I don't have
to upload. That means C: and D: are in the same machine. This is for
convenience only
In addition, I want to know to get the value(string) of the path
"C:\...\myDocument\thisfile.txt", whose value is also from by click on the
"Browse..." button. This value can be caught after submitting the form.

Any
idea?
Thanks
--
Andrew
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
Have you already uploaded the file to C:\whatever\ on the server? Or is that location on the client?

You can't access the client's file system directly... you will need to
upload the file to the server, and if you're doing that, just save the

file
to d:\data\ (how you do this depends on the component you're using).

For information on copying/moving files, see http://www.aspfaq.com/2039
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Andrew" <du******@yahoo.com> wrote in message
news:8k********************@twister01.bloor.is.net .cable.rogers.com...
> Hi,
>
> I want to copy a file from a variable location
> "C:\...\myDocument\thisfile.txt" to a destination D:\data\
> How can I do that? I tried to get the path from <input tyep=file>,

but I > couldn't pass this value to the filesystemobject
> Thanks for any idea.
> --
> Andrew
>
>
>



Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.