473,382 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

copy file from a location variable

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
8 2029
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
<%
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
> <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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chuck Anderson | last post by:
I've read some discussions, searched Google, tried pack, unpack, bin2hex, explode, implode, and I just can't figure out how to convert this data. I am trying to read a file with the following...
0
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape....
8
by: RonHiler | last post by:
My copy constructor is crashing my program, and I can't figure out why. I'll try to make the code listing as short as I can. Here are the two headers: class BreakthroughClass { public:...
16
by: bluekite2000 | last post by:
I want Matrix A(B) to create shallow copy of B but A=B to create deep copy of B. Is that bad design? Why and why not?
5
by: IdeaMan | last post by:
Windows 2000 Access 97 I am working on an issue tracking DB, where I need to link (not attach due to size)screen prints of various system errors. I have created a public folder on a network...
1
by: Todd Sparks | last post by:
I am developing with VB.NET 2005 and I need to copy a file from somewhere on the users machine to a secured location on the server. I am creating an image archive system that will allow users to...
15
by: subramanian100in | last post by:
consider the following program: #include <iostream> using namespace std; class Test { public: Test(int xx) : x(xx) { cout << x << endl; }
1
by: dwaterpolo | last post by:
Hi Everyone, I am trying to read two text files swY40p10t3ctw45.col.txt and solution.txt and compare them, the first text file has a bunch of values listed like: y y y y y y y
10
by: Jason | last post by:
I want to create a simple program with Two buttons on the form. BUTTON 1 - BACKUP PREFS this will do the following: Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.