Forums

This topic is locked

Pure ASP...how to give image a particular name.

Posted 25 Jan 2002 21:11:12
1
has voted
25 Jan 2002 21:11:12 Lynn Bantley posted:
Hello,

Am using Puer ASP Upload 2.07. While I want to allow my client to upload an image by selecting it with the browse button, I want to be able to rename the uploaded image to a particular name.

When they go to upload an image, I want to be able to rename the uploaded image to the ID number of the next record in the database.

I can get that next number just fine, but I do not know where to change the code to rename the image's filename that gets loaded to the database.

Example...the last record in the database is 35. When the customer goes to upload the next item in the database, the ID for that record is going to be 36 (it is set to autonumber). I then want whatever image file they upload to be renamed to 36.gif or 36.jpg.

I am only allowing one image to be uploaded per record.

Thank you for the help,

Lynn

Replies

Replied 25 Jan 2002 22:41:07
25 Jan 2002 22:41:07 Viktor Farcic replied:
I don't think that your system for quessing users ID is good. What if two users are uploading image at the same time? Will they both have same ID or will their ID's be switched... I would do the following. Let them update image as it is. Once the upload is complete and data stored in table, change image name to ID allready stored in DB.
For changing image name take a look at: www.4guysfromrolla.com/ASPScripts/PrintFAQ.asp?FAQID=36

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hello,

Am using Puer ASP Upload 2.07. While I want to allow my client to upload an image by selecting it with the browse button, I want to be able to rename the uploaded image to a particular name.

When they go to upload an image, I want to be able to rename the uploaded image to the ID number of the next record in the database.

I can get that next number just fine, but I do not know where to change the code to rename the image's filename that gets loaded to the database.

Example...the last record in the database is 35. When the customer goes to upload the next item in the database, the ID for that record is going to be 36 (it is set to autonumber). I then want whatever image file they upload to be renamed to 36.gif or 36.jpg.

I am only allowing one image to be uploaded per record.

Thank you for the help,

Lynn

<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager
Replied 25 Jan 2002 22:46:14
25 Jan 2002 22:46:14 Lynn Bantley replied:
Hi Victor,

Thanks for input. I would not really be guessing ID's...this would be a system that only one admin would be inputting information at a time. It is a review of running shoes. Each shoe is assigned an id # when it is input.

I will however look at the 4guys article...I could see how, *if* they had two people working on the system at the same time, I could be in trouble.

Still...anyone have information on renaming the image file name using ASP Pure?

Thanks,

Lynn


Replied 26 Jan 2002 12:54:15
26 Jan 2002 12:54:15 Viktor Farcic replied:
Never try to make a page based only on current demands. Maybe you have only one 'admin' now but, believe me, you don't want to change half of the code if one day another 'admin' occures.
Think of UlraDev as a tool that can help you to learn how to 'hand code' and that can speed up production time. Don't try to make everything with it's 'ready-to-go' solutions. UD is a good program but it can't replace programming and it can't do all the work you need.
I've took another look at the article I sent you. It's very easy to implement those few lines of code. Give it a try.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi Victor,

Thanks for input. I would not really be guessing ID's...this would be a system that only one admin would be inputting information at a time. It is a review of running shoes. Each shoe is assigned an id # when it is input.

I will however look at the 4guys article...I could see how, *if* they had two people working on the system at the same time, I could be in trouble.

Still...anyone have information on renaming the image file name using ASP Pure?

Thanks,

Lynn



<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager

Reply to this topic