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

Rename a file

P: n/a
tom
Hello, got a prob with renaming a file; still don't know where is the
mistake.
this is the code:
<%
'************************************************* **************************
*
file_orig=session("nome_file")
file_copy=session("id_risp") & "_" & session("id_recl")
'path_copy=Server.Mappath("/document/" & file_copy & ".doc")

'response.write(file_orig)&"<br>"
'response.write(file_copy)&"<br>"
'response.end

Dim fso
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.MoveFile file_orig, file_copy <--( ROW: 117 )
set fso = nothing
%>
and this is the Error :

Microsoft VBScript runtime error '800a0035'

File not found

/aaaa/bbbb/zzzz/frm_risp_new_sql.asp, line 117

Have u got any clue?
Jul 21 '05 #1
Share this Question
Share on Google+
17 Replies


P: n/a
What are the values of file_orig and file_copy and does file_orig exist?

What is the intended purpose of path_copy and why is it commented out?

Paul

"tom" <tg***@libero.it> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl...
Hello, got a prob with renaming a file; still don't know where is the
mistake.
this is the code:
<%
'************************************************* ************************** *
file_orig=session("nome_file")
file_copy=session("id_risp") & "_" & session("id_recl")
'path_copy=Server.Mappath("/document/" & file_copy & ".doc")

'response.write(file_orig)&"<br>"
'response.write(file_copy)&"<br>"
'response.end

Dim fso
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.MoveFile file_orig, file_copy <--( ROW: 117 )
set fso = nothing
%>
and this is the Error :

Microsoft VBScript runtime error '800a0035'

File not found

/aaaa/bbbb/zzzz/frm_risp_new_sql.asp, line 117

Have u got any clue?

Jul 21 '05 #2

P: n/a
tom wrote:
Hello, got a prob with renaming a file; still don't know where is the
mistake.
this is the code:
<%
'************************************************* ************************** *
file_orig=session("nome_file")
file_copy=session("id_risp") & "_" & session("id_recl")
'path_copy=Server.Mappath("/document/" & file_copy & ".doc")

'response.write(file_orig)&"<br>"
'response.write(file_copy)&"<br>"
'response.end

Dim fso
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.MoveFile file_orig, file_copy <--( ROW: 117 )
set fso = nothing
%>
and this is the Error :

Microsoft VBScript runtime error '800a0035'

File not found

/aaaa/bbbb/zzzz/frm_risp_new_sql.asp, line 117

Have u got any clue?


My guess: make sure you're looking for the right file. I see you have some
response.writes commented out. Have you verified that the correct path and
file are being stored in file_orig? If so, does the user account have
sufficient file system permissions for this file?

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 21 '05 #3

P: n/a
Well, can you uncomment this and tell us the results? Have you verified
that the file exists?
'response.write(file_orig)&"<br>"


You can also use the FileExists method, e.g.

if not fso.FileExists(file_orig) then
response.write "Couldn't find " & file_orig
else
' ... do stuff with file ...
end if

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 21 '05 #4

P: n/a
What is the value of file_copy?

file_copy=session("id_risp") & "_" & session("id_recl")
RESPONSE.WRITE file_copy
RESPONSE.END

Ray at home
"tom" <tg***@libero.it> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl...
Hello, got a prob with renaming a file; still don't know where is the
mistake.
this is the code:
<%
'************************************************* **************************
*
file_orig=session("nome_file")
file_copy=session("id_risp") & "_" & session("id_recl")
'path_copy=Server.Mappath("/document/" & file_copy & ".doc")

'response.write(file_orig)&"<br>"
'response.write(file_copy)&"<br>"
'response.end

Dim fso
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.MoveFile file_orig, file_copy <--( ROW: 117 )
set fso = nothing
%>
and this is the Error :

Microsoft VBScript runtime error '800a0035'

File not found

/aaaa/bbbb/zzzz/frm_risp_new_sql.asp, line 117

Have u got any clue?

Jul 21 '05 #5

P: n/a
tom
Just want to reply back to all of you. hope to be clear on every points.
file_orig=session("nome_file") | Result -> ( original_file_uploaded.ext ) file_copy=session("id_risp") & "_" & session("id_recl") | Result -> ( same_file_with_2ID_joined_by_the_underscore.doc )

path_copy=Server.Mappath("/document/" & file_copy & ".doc") | esult ->( c:\inetpub\wwwroot\document\24_32.doc ) (example)

path is commented cause I wanted to check out where the file was going to be
saved.In fact I didn't understand either why I've got the
path of my local computer and not the one of the server.

Then I checked all the permission and they are all fine.

Other thing I want to add is that all the files are going to be saved in
that folder called "document" and to be overwritten to the file if
it is already uploaded, so this is the issue why I would change the name of
file with the 2 IDs.

cheers, let me know if u want more details,
- tommy
----------------------------------------------------------------------------
--------------------------------------------------------------

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
tom wrote:
Hello, got a prob with renaming a file; still don't know where is the
mistake.
this is the code:
<%

'************************************************* ************************** *
file_orig=session("nome_file")
file_copy=session("id_risp") & "_" & session("id_recl")
'path_copy=Server.Mappath("/document/" & file_copy & ".doc")

'response.write(file_orig)&"<br>"
'response.write(file_copy)&"<br>"
'response.end

Dim fso
set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.MoveFile file_orig, file_copy <--( ROW: 117 )
set fso = nothing
%>
and this is the Error :

Microsoft VBScript runtime error '800a0035'

File not found

/aaaa/bbbb/zzzz/frm_risp_new_sql.asp, line 117

Have u got any clue?


My guess: make sure you're looking for the right file. I see you have some
response.writes commented out. Have you verified that the correct path and
file are being stored in file_orig? If so, does the user account have
sufficient file system permissions for this file?

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 21 '05 #6

P: n/a
> > > file_orig=session("nome_file")
| Result -> ( original_file_uploaded.ext )


This needs a PATH, not just a bare filename! Maybe try
server.mappath(session("nome_file")) if you want the file to be in the same
folder as the ASP code. Or, consider defining a path. If you give it just
a filename, it looks in C:\windows\system32\ and I can pretty much guarantee
that "all the permission" are not fine there (nor should they be).

A
Jul 21 '05 #7

P: n/a
tom
The 'session("nome_file") ' is related to another file called
uploadclass.asp
inside of this class we've got functions that defined more points about the
file is going to be uploaded.
So I've got also a function that defines the path of the file as well.
Maybe was a thought of mine cares about the path, but actually is not my
first problem cause ,
when I upload a file is going straight to the folder 'document'.
The real issue I want to solve is just rename my file.
I used the fso.MoveFile but doesn't work properly.
So I would ask you if eventually, you've got other alternative solutions
without using the Server.Mappath and so on
but simply substitute the name.this thing drives me nut.
thanks


"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:uY**************@tk2msftngp13.phx.gbl...
> file_orig=session("nome_file") | Result -> ( original_file_uploaded.ext )


This needs a PATH, not just a bare filename! Maybe try
server.mappath(session("nome_file")) if you want the file to be in the

same folder as the ASP code. Or, consider defining a path. If you give it just a filename, it looks in C:\windows\system32\ and I can pretty much guarantee that "all the permission" are not fine there (nor should they be).

A

Jul 21 '05 #8

P: n/a
> The real issue I want to solve is just rename my file.

Okay, you STILL have to pass a VALID PATH to the MoveFile (or any other FSO)
method/property. You weren't doing that, you were just giving it a file
name, so it was looking in system32. Why do you think some other ASP file
has any bearing on what you're doing in this file???

http://www.aspfaq.com/2039#rename
http://www.aspfaq.com/2074
Jul 21 '05 #9

P: n/a
> Maybe was a thought of mine cares about the path, but actually is not
my first problem cause ,

<snip>

Huh???

Could you rewrite that please? In English? I've read it twice and I still
haven't the slightest idea about what you're trying to say.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 21 '05 #10

P: n/a
tom
Sorry about my english, bob.
I just tried to say, that my first problem is concerning about
renaming a file rather than find out more about the path.
Of course Aaron is right when he says that first I should
sort out with the path.
however I don't know how to behave in this case cause
is a brand new stuff for me, if could give me some advice,
would be appriciated.
thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eY**************@TK2MSFTNGP14.phx.gbl...
Maybe was a thought of mine cares about the path, but actually is not
my first problem cause ,

<snip>

Huh???

Could you rewrite that please? In English? I've read it twice and I still
haven't the slightest idea about what you're trying to say.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 21 '05 #11

P: n/a
Uh-oh. You're not a native English speaker? If so, my apologies. I was
assuming you were being lazy, instead of having problems expressing yourself
in a different language.

However, I'm still having difficulties understanding what your problem is.
Hopefully someone else can help.

Bob Barrows
tom wrote:
Sorry about my english, bob.
I just tried to say, that my first problem is concerning about
renaming a file rather than find out more about the path.
Of course Aaron is right when he says that first I should
sort out with the path.
however I don't know how to behave in this case cause
is a brand new stuff for me, if could give me some advice,
would be appriciated.
thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eY**************@TK2MSFTNGP14.phx.gbl...
Maybe was a thought of mine cares about the path, but actually is
not my first problem cause ,

<snip>

Huh???

Could you rewrite that please? In English? I've read it twice and I
still haven't the slightest idea about what you're trying to say.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 21 '05 #12

P: n/a
Simply hard-code all the values first, and get that working.

c:\origfile.txt

c:\destfile.txt

Jeff

"tom" <tg***@libero.it> wrote in message
news:#S*************@TK2MSFTNGP11.phx.gbl...
Sorry about my english, bob.
I just tried to say, that my first problem is concerning about
renaming a file rather than find out more about the path.
Of course Aaron is right when he says that first I should
sort out with the path.
however I don't know how to behave in this case cause
is a brand new stuff for me, if could give me some advice,
would be appriciated.
thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eY**************@TK2MSFTNGP14.phx.gbl...
Maybe was a thought of mine cares about the path, but actually is not
my first problem cause ,

<snip>

Huh???

Could you rewrite that please? In English? I've read it twice and I still haven't the slightest idea about what you're trying to say.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Jul 21 '05 #13

P: n/a
Okay, here it is in plain English.

fso.MoveFile test.txt test2.txt is BAD!
fso.MoveFile c:\test.txt c:\test2.txt is GOOD. c:\test.txt MUST EXIST.

You must pass fully-qualified file name to MoveFile and the source file must
exist.

Paul

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
Uh-oh. You're not a native English speaker? If so, my apologies. I was
assuming you were being lazy, instead of having problems expressing yourself in a different language.

However, I'm still having difficulties understanding what your problem is.
Hopefully someone else can help.

Bob Barrows
tom wrote:
Sorry about my english, bob.
I just tried to say, that my first problem is concerning about
renaming a file rather than find out more about the path.
Of course Aaron is right when he says that first I should
sort out with the path.
however I don't know how to behave in this case cause
is a brand new stuff for me, if could give me some advice,
would be appriciated.
thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eY**************@TK2MSFTNGP14.phx.gbl...
Maybe was a thought of mine cares about the path, but actually is
not my first problem cause ,
<snip>

Huh???

Could you rewrite that please? In English? I've read it twice and I
still haven't the slightest idea about what you're trying to say.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 21 '05 #14

P: n/a
:-)
Sure, but others, including Aaron have said that. How does that address the
rest of his concerns (whatever they are)? He seems to have some sort of
objection to using the path that I just don't understand. Do you?

Bob

Paul Baker [MVP, Windows - SDK] wrote:
Okay, here it is in plain English.

fso.MoveFile test.txt test2.txt is BAD!
fso.MoveFile c:\test.txt c:\test2.txt is GOOD. c:\test.txt MUST EXIST.

You must pass fully-qualified file name to MoveFile and the source
file must exist.

Paul

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
Uh-oh. You're not a native English speaker? If so, my apologies. I
was assuming you were being lazy, instead of having problems
expressing yourself in a different language.

However, I'm still having difficulties understanding what your
problem is. Hopefully someone else can help.

Bob Barrows
tom wrote:
Sorry about my english, bob.
I just tried to say, that my first problem is concerning about
renaming a file rather than find out more about the path.
Of course Aaron is right when he says that first I should
sort out with the path.
however I don't know how to behave in this case cause
is a brand new stuff for me, if could give me some advice,
would be appriciated.
thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eY**************@TK2MSFTNGP14.phx.gbl...
> Maybe was a thought of mine cares about the path, but actually is
> not my first problem cause ,
<snip>

Huh???

Could you rewrite that please? In English? I've read it twice and I
still haven't the slightest idea about what you're trying to say.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 21 '05 #15

P: n/a
Bob,

No, I don't understand. I was trying to just reiterate everyone else's good
advice as clearly and concisely as possible.

If he is renaming a file, it has to exist and he has to know what the file
name is. Nothing else makes sense, and the other IIS related details seem
kind of irrelevant.

Paul

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uM**************@TK2MSFTNGP15.phx.gbl...
:-)
Sure, but others, including Aaron have said that. How does that address the rest of his concerns (whatever they are)? He seems to have some sort of
objection to using the path that I just don't understand. Do you?

Bob

Paul Baker [MVP, Windows - SDK] wrote:
Okay, here it is in plain English.

fso.MoveFile test.txt test2.txt is BAD!
fso.MoveFile c:\test.txt c:\test2.txt is GOOD. c:\test.txt MUST EXIST.

You must pass fully-qualified file name to MoveFile and the source
file must exist.

Paul

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
Uh-oh. You're not a native English speaker? If so, my apologies. I
was assuming you were being lazy, instead of having problems
expressing yourself in a different language.

However, I'm still having difficulties understanding what your
problem is. Hopefully someone else can help.

Bob Barrows
tom wrote:
Sorry about my english, bob.
I just tried to say, that my first problem is concerning about
renaming a file rather than find out more about the path.
Of course Aaron is right when he says that first I should
sort out with the path.
however I don't know how to behave in this case cause
is a brand new stuff for me, if could give me some advice,
would be appriciated.
thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eY**************@TK2MSFTNGP14.phx.gbl...
>> Maybe was a thought of mine cares about the path, but actually is
>> not my first problem cause ,
> <snip>
>
> Huh???
>
> Could you rewrite that please? In English? I've read it twice and I
> still haven't the slightest idea about what you're trying to say.
>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 21 '05 #16

P: n/a
Tom
this is the actual situation:
I've got a form with 3(+1) fields
0.ID(hidden)
1.Date(irrelevant)
2.Title(irrelevant)
3.File to upload -> Now everytime somebody's going to upload the original
file, the file itself keeps the original name.So at this point I would
change
this name with another one which is the union between the first ID and the
ID
of another table separated by a "_" (example -> "32_15.doc" instead of
"pippo.doc").
I 'm doing this cause I'd like to avoid to overwrite a file.

For what concerns the path instead I still have difficulties to understand
how it works.
cause if am extracting the file's path I get the path of my local computer
which is:
C:\prog\......\document\32_15.doc
I dont know if it is right cause am working straight on the server and not
on my local
PC. So I dont really know if it should have a different path or what. for
example
ip_number\fold_1\fold_2\....fold_n\document\32_15. doc??

Let me know, cheers


"Paul Baker [MVP, Windows - SDK]" <pa***@online.rochester.rr.com> wrote in
message news:eY**************@TK2MSFTNGP12.phx.gbl...
Bob,

No, I don't understand. I was trying to just reiterate everyone else's good advice as clearly and concisely as possible.

If he is renaming a file, it has to exist and he has to know what the file
name is. Nothing else makes sense, and the other IIS related details seem
kind of irrelevant.

Paul

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uM**************@TK2MSFTNGP15.phx.gbl...
:-)
Sure, but others, including Aaron have said that. How does that address

the
rest of his concerns (whatever they are)? He seems to have some sort of
objection to using the path that I just don't understand. Do you?

Bob

Jul 21 '05 #17

P: n/a
Tom,

You have to figure out if the source file exists on the server or not. If
not, how are you going to debug it? Is someone restricting your access to
the server?

Paul

"Tom" <tg***@libero.it> wrote in message
news:ez**************@TK2MSFTNGP14.phx.gbl...
this is the actual situation:
I've got a form with 3(+1) fields
0.ID(hidden)
1.Date(irrelevant)
2.Title(irrelevant)
3.File to upload -> Now everytime somebody's going to upload the original
file, the file itself keeps the original name.So at this point I would
change
this name with another one which is the union between the first ID and the
ID
of another table separated by a "_" (example -> "32_15.doc" instead of
"pippo.doc").
I 'm doing this cause I'd like to avoid to overwrite a file.

For what concerns the path instead I still have difficulties to understand
how it works.
cause if am extracting the file's path I get the path of my local computer
which is:
C:\prog\......\document\32_15.doc
I dont know if it is right cause am working straight on the server and not
on my local
PC. So I dont really know if it should have a different path or what. for
example
ip_number\fold_1\fold_2\....fold_n\document\32_15. doc??

Let me know, cheers


"Paul Baker [MVP, Windows - SDK]" <pa***@online.rochester.rr.com> wrote in
message news:eY**************@TK2MSFTNGP12.phx.gbl...
Bob,

No, I don't understand. I was trying to just reiterate everyone else's

good
advice as clearly and concisely as possible.

If he is renaming a file, it has to exist and he has to know what the file name is. Nothing else makes sense, and the other IIS related details seem kind of irrelevant.

Paul

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uM**************@TK2MSFTNGP15.phx.gbl...
:-)
Sure, but others, including Aaron have said that. How does that address
the
rest of his concerns (whatever they are)? He seems to have some sort

of objection to using the path that I just don't understand. Do you?

Bob


Jul 21 '05 #18

This discussion thread is closed

Replies have been disabled for this discussion.