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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming uploaded files

Status
Not open for further replies.

Cineno

Programmer
Jul 24, 2006
142
US
Hello, sorry if this question has been asked before, if so please direct me to it, i didn't see anything.

I have a page that I want to allow users to have the ability to upload files to a folder on our server.

I've tried using the simple ASPUpload as shown below:

Upload.html:
________________
<HTML>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="upload.asp">
<INPUT TYPE= FILE SIZE= 60 NAME="FILE1"> <BR>
<INPUT TYPE="SUBMIT" VALUE="Upload!">
</FORM>
</BODY>
</HTML>
________________

Upload.asp:

________________
<%

Set Upload = Server.CreateObject ("Persits.Upload.1")
Count = Upload.SaveVirtual ("/data/Example")

Set Upload = Nothing

response.redirect "EmpProfile.asp?file=1"
%>
<% = Count %> file(s) uploaded.
________________


This has worked and has saved the file to server. The issue I have now is that I want to be able to rename the file they are uploading, in order to append an ID number onto it. Then if they are looking at someone's page and there is a file with that person's ID number on it, it will show a link so they can download the file.

Does anyone have any tips of how to accomplish renaming the file, and then showing a link to it based on a substring of the file name?

Any help is appreciated!
 
You can use tps14334's method to rename the uploaded file, it's really a "move" as far as the filescriptingobject is concerned...

To get the original file name you can check out Persits object reference for aspupload...



--------

GOOGLE is a great resource to find answers to questions like "how do i..."


--------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top