Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPUpload renaming files

Status
Not open for further replies.

xscape

Programmer
Apr 18, 2001
144
GB
Hi all!

Here's my prob (it seems kinda silly cos it's so simple):

I wrote a very small script that uses the ASPUpload object by Persits ( It's pretty basic, and just allows you to upload to different folders on the server, and it does that well. However, I'm trying to find a way that will allow me to upload any file, but it will always be given a specified file name. Eg If I upload readme1.txt it will be renamed readme.txt so I can upload readme2.txt, readme3.txt, readme4.txt etc and they will always just overwrite the existing readme.txt file on the server.

Here's what the basic of the current script:
<%
strFolder = Request.querystring(&quot;dest&quot;)
strPath = server.mappath(strFolder)

Set Upload = Server.CreateObject(&quot;Persits.Upload.1&quot;)
Count = Upload.Save(strPath)
%>
<HTML>
<BODY BGcolor=&quot;#000000&quot; vlink=&quot;#FFFFFF&quot; alink=&quot;#FFFFFF&quot; link=&quot;#FFFFFF&quot;>
<center><b><font color=&quot;#FFFFFF&quot;>
<% = Count %> files uploaded successfully! </b></font><br><br>
<a href=&quot;uploadform.asp&quot;>Back to upload form</a>
</center>
</BODY>
</HTML>


Now I've been trying the file.Move way of doing it which should work, but I keep getting an Object required error on the line referring to file.Move:

<%
...

Set Upload = Server.CreateObject(&quot;Persits.Upload.1&quot;)
Count = Upload.Save(strPath)
file.Move strPath & &quot;/read.txt&quot;

...
%>

I've tried various combinations of this and it's just not having any of it. I think it's probably blatantly obvious, but I can't see what I'm doing wrong. Any ideas anyone!?

Thanks a lot in advance! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top