Click to See Complete Forum and Search --> : FileSystemObjetc
Hi everyone :)
Can i using file system object to rename my file since i can get file ?
Also,
Can anyone know how to using ASP to rotate image to maybe 90,180, 270 degree? Do anyone have the ASP component or where can I find it?
Need response ASAP
Thx in advance
:o Mac :)
r0ach
Jun 25th, 2000, 06:34 PM
OK.
To rename a file, I would do this:
1.) Read the whole file
2.) Write it to a new file
3.) Delete old file
about the rotating picture, if you can't find a component to do it, write one.
r0ach
Jun 25th, 2000, 06:50 PM
Let me be clearer about the rename:
<%
Sub Rename(path, oldfile, newfile)
set fso = Server.CreateObject("Scripting.FileSystemObject")
'first check if path and oldfile is valid. I skipped it.
'assumed it's valid
'also check if newfile exist. we don't want to overwrite existing files
oPath = path & oldfile
nPath = path & newfile
'copy old file to new file
fso.CopyFile oPath, nPath, False
'delete old file
fso.DeleteFile oPath, True
Set fso = nothing
' you could leave out the path parameter,
' but then you must include it into each filename
End Sub
'Usage:
Rename("C:\My Documents\", "Test1.txt", "Test2.txt")
%>
Should work. Haven't tested it.
[Edited by r0ach on 06-26-2000 at 07:53 AM]
r0ach
Jun 25th, 2000, 07:00 PM
****, sorry. Made a mistake.
CopyFile method won't take new filename for destination. (I think)
Replace the whole "fso.copyfile" line in previous post with:
'open file
Set oF = fso.GetFile oPath
'create new file
Set nF = fso.CreateFile nPath, False 'don't want to overwrite existing file
'copy old file to new file
nF.Write oF.ReadAll
'close files
oF.Close
nF.Close
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.