rename file before uploading usin SAfileUp

Posted on 2003-03-20
Medium Priority
Last Modified: 2008-03-10
I'm using the SAfileUp object in order to allow to upload files to my server.
the method I'm using is SaveAs this way:

fileUp.FORM("file_link").SaveAs upload_path + fileName

everything works fine and the file is saved.
What I want is to check wether a file under that name is already exsits in this folder
if so I want to change the name of the new file and only then save it.
for example if I want to upload "thanks.jpg" and file by this name is already exists in my folder so
the new "thanks.jpg" will be renamed to "thanks1.jpg"

How can I do this? using saFileUp? using fso?
I don't have many points to give but I'll be greatful for any response

Question by:ronn1212
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

chisholmd earned 80 total points
ID: 8174880
Yes you would use FSO to see if the file already exists.  Alternativly you could automatically save every uploaded file with a unique name made up of the userfilename and the date.  Depending on your needs of course.

IF you use FSO :

vFileName = [insertUserFileName]
set fso = server.createobject("scripting.filesystemobject")
if fso.fileexists(upload_path & vFileName) then
 vFileName = month(date) & day(date) & year(date) & vFileName
end if
set fso = nothing

fileUp.FORM("file_link").SaveAs upload_path + vFileName


Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question