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/direc鈥?/a>How 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(
';C:\Dir1\SomeFile.txt';,
';C:\Dir1\RenamedFileName.txt';)
C#:
File.Move(
@';C:\Dir1\SomeFile.txt';,
@';C:\Dir1\RenamedFileName.txt';)
No comments:
Post a Comment