473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Changing file name

Vb.net 2003, Web application
Hey all!

Just a quick question.

I have a site which allows users the ability to upload files by the
HTML brows button control.

My question is if a user submits a file,, and every file they submit I
want my code to change the name of it.. So say the user submits
'Hello.txt'. When they press submit I want it to be changed to
'Hello1.txt'. I tried just changing the name but it stopped the file
from working. Or also. what commands does one use to just change the
name of a selected file on the local machine?

Any help would be greatly appreciated.

Thanx in Advance
Chris

Dec 19 '06 #1
3 1723
Bonzol,

For the file upload it is very important what method you use on the Server
side.
There is no standard method for that.

(Asp)Net has as least 2 classes for that, using those you can sure after the
upload change the dataname or the file path (or Database) were you want to
store it.

Therefore show the serverpart so we see how you handle the input/file

Cor

"Bonzol" <Bo****@hotmail.comschreef in bericht
news:11**********************@a3g2000cwd.googlegro ups.com...
Vb.net 2003, Web application
Hey all!

Just a quick question.

I have a site which allows users the ability to upload files by the
HTML brows button control.

My question is if a user submits a file,, and every file they submit I
want my code to change the name of it.. So say the user submits
'Hello.txt'. When they press submit I want it to be changed to
'Hello1.txt'. I tried just changing the name but it stopped the file
from working. Or also. what commands does one use to just change the
name of a selected file on the local machine?

Any help would be greatly appreciated.

Thanx in Advance
Chris

Dec 19 '06 #2
Chris,

While I don't really have the programming skills necessary to actually whip
out the code quickly, in pseudo-code the logic would run something like the
following...

If user uploads file then
get the filename of the file
check the data storage and get the total number of files uploaded by the
user
assign the upper bound of the data storage to a variable
increment the variable by one
split the filename at the "." into two temp variables
concatenate the storage variable onto the end of temp1 variable and
then...
concatenate temp2 back onto the end of temp1 and assign that name to the
file.

VB.Net has many methods that I've been learning about recently that can do
wonderful things and my little example may be a bit too verbose... or not
verbose enough. :) I've actually been 'reading' through the help and
checking out the methods and properties of methods along with the help I've
been getting. Hope this helps you in some small way.

"Bonzol" <Bo****@hotmail.comwrote in message
news:11**********************@a3g2000cwd.googlegro ups.com...
Vb.net 2003, Web application
Hey all!

Just a quick question.

I have a site which allows users the ability to upload files by the
HTML brows button control.

My question is if a user submits a file,, and every file they submit I
want my code to change the name of it.. So say the user submits
'Hello.txt'. When they press submit I want it to be changed to
'Hello1.txt'. I tried just changing the name but it stopped the file
from working. Or also. what commands does one use to just change the
name of a selected file on the local machine?

Any help would be greatly appreciated.

Thanx in Advance
Chris

Dec 19 '06 #3
Not a solution again though Cor
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:Ot*************@TK2MSFTNGP03.phx.gbl...
Bonzol,

For the file upload it is very important what method you use on the Server
side.
There is no standard method for that.

(Asp)Net has as least 2 classes for that, using those you can sure after
the
upload change the dataname or the file path (or Database) were you want to
store it.

Therefore show the serverpart so we see how you handle the input/file

Cor

"Bonzol" <Bo****@hotmail.comschreef in bericht
news:11**********************@a3g2000cwd.googlegro ups.com...
Vb.net 2003, Web application
Hey all!

Just a quick question.

I have a site which allows users the ability to upload files by the
HTML brows button control.

My question is if a user submits a file,, and every file they submit I
want my code to change the name of it.. So say the user submits
'Hello.txt'. When they press submit I want it to be changed to
'Hello1.txt'. I tried just changing the name but it stopped the file
from working. Or also. what commands does one use to just change the
name of a selected file on the local machine?

Any help would be greatly appreciated.

Thanx in Advance
Chris


Dec 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Cengiz Ulku | last post by:
Hi all, I know now how to change the font name of a RTF file in a RTB control using, for example: RTextBox1.SelFontName = cmbFonts.Text I have a RTF file -created with Word- displayed in a...
3
by: mvargasp | last post by:
Hi all, I have a web form which contains a frame, (a form containing a menu on the left and a web form containing a datagrid on the right). Also there is a button (right side) which transforms...
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
5
by: John Pass | last post by:
I saved a project accepting the defaults name “ConsoleApplication2”. After adding the code, I changed the name using “Rename” in the file directory. After opening the file, the project name...
1
by: mplus_2000 | last post by:
I have recently inherited a database. The switchboard (and other forms) displays the name of the database on it (top, center). Currently the name that appears is Reviews. There are plans to roll...
4
by: andychambers2002 | last post by:
I'm working on a "TempFile" class that stores the data in memory until it gets larger than a specified threshold (as per PEP 42). Whilst trying to implement it, I've come across some strange...
10
by: 7stud | last post by:
Hi, I'm experimenting with a basic socket program(from a book), and both the client and server programs are on my computer. In both programs, I call socket.gethostname(), but I discovered that...
1
by: rufusking | last post by:
My requirement is to change the IP Address of local system programatically using .net. IP Address should change to 10.1.2.100, subnet mask = 255.255.255.0, default gateway=10.1.2.1 I have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.