473,830 Members | 2,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rename a file

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

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

Dim fso
set fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
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_sq l.asp, line 117

Have u got any clue?
Jul 21 '05 #1
17 2096
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.i t> wrote in message
news:Ou******** ******@TK2MSFTN GP10.phx.gbl...
Hello, got a prob with renaming a file; still don't know where is the
mistake.
this is the code:
<%
'************** *************** *************** *************** *************** * *
file_orig=sessi on("nome_file" )
file_copy=sessi on("id_risp") & "_" & session("id_rec l")
'path_copy=Serv er.Mappath("/document/" & file_copy & ".doc")

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

Dim fso
set fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
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_sq l.asp, line 117

Have u got any clue?

Jul 21 '05 #2
tom wrote:
Hello, got a prob with renaming a file; still don't know where is the
mistake.
this is the code:
<%
'************** *************** *************** *************** *************** * *
file_orig=sessi on("nome_file" )
file_copy=sessi on("id_risp") & "_" & session("id_rec l")
'path_copy=Serv er.Mappath("/document/" & file_copy & ".doc")

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

Dim fso
set fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
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_sq l.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
Well, can you uncomment this and tell us the results? Have you verified
that the file exists?
'response.write (file_orig)&"<b r>"


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
What is the value of file_copy?

file_copy=sessi on("id_risp") & "_" & session("id_rec l")
RESPONSE.WRITE file_copy
RESPONSE.END

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

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

Dim fso
set fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
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_sq l.asp, line 117

Have u got any clue?

Jul 21 '05 #5
tom
Just want to reply back to all of you. hope to be clear on every points.
file_orig=sessi on("nome_file" ) | Result -> ( original_file_u ploaded.ext ) file_copy=sessi on("id_risp") & "_" & session("id_rec l") | Result -> ( same_file_with_ 2ID_joined_by_t he_underscore.d oc )

path_copy=Serve r.Mappath("/document/" & file_copy & ".doc") | esult ->( c:\inetpub\wwwr oot\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******@NOyah oo.SPAMcom> wrote in message
news:uS******** ******@TK2MSFTN GP12.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=sessi on("nome_file" )
file_copy=sessi on("id_risp") & "_" & session("id_rec l")
'path_copy=Serv er.Mappath("/document/" & file_copy & ".doc")

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

Dim fso
set fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
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_sq l.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
> > > file_orig=sessi on("nome_file" )
| Result -> ( original_file_u ploaded.ext )


This needs a PATH, not just a bare filename! Maybe try
server.mappath( session("nome_f ile")) 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\syst em32\ and I can pretty much guarantee
that "all the permission" are not fine there (nor should they be).

A
Jul 21 '05 #7
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*****@dnartr eb.noraa> wrote in message
news:uY******** ******@tk2msftn gp13.phx.gbl...
> file_orig=sessi on("nome_file" ) | Result -> ( original_file_u ploaded.ext )


This needs a PATH, not just a bare filename! Maybe try
server.mappath( session("nome_f ile")) 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\syst em32\ and I can pretty much guarantee that "all the permission" are not fine there (nor should they be).

A

Jul 21 '05 #8
> 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
> 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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
9523
by: Tom | last post by:
I'm having a problem using a path with spaces as a parameter to os.rename() in a program on WinXP. This works fine at the command line (where the folder "c:\aa bb" exists) > os.rename( "c\aa bb", "c:\cc dd" ); > But, I can't get it to work in my program, eg.
5
2758
by: jez123456 | last post by:
Hi, I’ve written a c# program to compact certain msaccess databases. The way this works is to compact say C:\test1.mdb to C:\temp.mdb, then delete C:\test1.mdb and rename C:\temp.mdb as C:\test1.mdb. My problem occurs if there is already a C:\temp.mdb file. I don’t want to just delete this, as it could have been created separately by a user. In my code, I set a constant as follows: private const string tempMdb = @"C:\temp.mdb";
1
2010
by: Jay at SCA | last post by:
I've been having the following issue with a windows service I've created in vb.net (.net fw 1.1): Basically, my service monitors a folder for the creation of any new files of a particular type and renames them using the "Rename(oldfilename,newfilename)" function. Unfortunately, this function only seems to work if and only if it is preceeded by a 'msgbox("<some text>")'. ie. If I have the following the service sees the file
2
2968
by: Bruce Russell | last post by:
This may sound stupid but I can't rename the WebForm1.aspx in the solution explorer. The file is located in my local web server at C:\Inetpub\wwwroot\Lab3-VB-Starter\WebForm1.aspx Is there some configuration problem in my IIS setup? Thanks,
5
4468
by: Rothariger | last post by:
Hello.... i want to know if its posible to rename multiple files like windows does.. example: file zzzzzzz.doc file asdasd.doc file esfsefse.doc
5
2737
by: Tony Meyer | last post by:
On Windows, if I do os.rename(old, new) where old is a file that is in-use (e.g. python itself, or a dll that is loaded), I would expect that an error would be raised (e.g. as when os.remove is called with an in-use file). However, what happens is that a copy of the file is made, and the old file still exists. For example: C:\>c:\python24\python.exe Python 2.4.2 (#67, Sep 28 2005, 12:41:11) on win32
5
3062
by: VB Programmer | last post by:
My web hoster says that I have to rename my ASPNETDB.MDF SqlExpress db for my 2.0 site to work. Is this accurate? If so, how can I rename it without breaking anything on my site? FYI: This is the error I'm getting after I publish my site to their servers... An attempt to attach an auto-named database for file c:\hosting\myhost\member\myaccount\customerdomains\mysite\App_Data\ASPNETDB.MDF failed. A database with the same name exists,...
12
2912
by: mantrid | last post by:
Im trying to move a file but am having luck my code is below. The temp and target paths are valid as they echo correctly. but I cant get the copy() function to work, or the rename() function $target_path = $targetdir . basename($uploadedfile); $temp_path = $tempdir. basename($uploadedfile); echo "Target - ".$target_path." Temp - ".$temp_path."<br>";
1
4525
by: spacehopper_man | last post by:
no "rename" operation in C# !!! - this has been covered in this group before, but I can't find any good answers. what I am trying to do is refresh the content in a file with minimum performance impact on any read operations to that file - a common task right.... in the unix world the way to do this is to create a temporary file with
2
3640
by: =?iso-8859-1?b?cultaQ==?= | last post by:
Hi, I would like to rename files (jpg's ones) using a text file containing the new names... Below is the code that doesn't work : ***** #!/usr/bin/python #-*- coding: utf-8 -*- from os import listdir, getcwd, rename import re
0
9793
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10774
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10489
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10202
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6950
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.