Friday, June 3, 2011

How do I change the name of an uploaded file with asp?

I have a page that allows a user to upload documents to a specified directory. I need to change the name of that file based on a name field (example:JohnDoe.doc). How can I get this done?How do I change the name of an uploaded file with asp?Here are two ways to rename files in ASP:





http://classicasp.aspfaq.com/files/direcHow do I change the name of an uploaded file with asp?Use namespace System.IO. The following examples should be on one line (don't break the line).



VB.NET:

File.Move(

%26quot;C:\Dir1\SomeFile.txt%26quot;,

%26quot;C:\Dir1\RenamedFileName.txt%26quot;)



C#:

File.Move(

@%26quot;C:\Dir1\SomeFile.txt%26quot;,

@%26quot;C:\Dir1\RenamedFileName.txt%26quot;)

No comments:

Post a Comment