Forums

This topic is locked

getting UNIQUE NAME in database

Posted 23 Oct 2002 13:26:28
1
has voted
23 Oct 2002 13:26:28 Wayne Hultum posted:
I seem to be having the problem a lot of other people have had. I have looked through the faq’s, tutorial files, and the forum and can now upload a file with a unique name but I am unable to get the unique file name in to the database.

I got the code from the tutorial “how to create a unique file name using Pure ASP upload1.

Using version 1:
GP_strm2.SaveToFile Trim(Server.mappath(GP_curPath))& "\" & strRandom & UploadRequest.Item(GP_curKey).Item("FileName"

In one reply in the forum it say you need to insert the following line in the database
UploadRequest.Item(GP_curKey).Item("FileName"
If this is the case how do you do that. If not could someone please shed light on what I need to be doing.

Many thanx

Replies

Replied 23 Oct 2002 13:54:46
23 Oct 2002 13:54:46 Martha Graham replied:
Take a look at this?

Version 2: find the line that starts with if UploadRequest.Item(GP_curKey).Item("FileName" <> ""

and add the following lines after after it - NOTE THE TWO OPTIONS HERE

to store the original filename in the database:

'add our random filename to the object
UploadRequest.Item(GP_curKey).Item("FileName" = strRandom & UploadRequest.Item(GP_curKey).Item("FileName"

I only wanted to store the original filename in the db, but this is how to store the full unique filename in the database (thanks to Pablo Deeleman)

'add our random filename to the object
UploadRequest.Item(GP_curKey).Item("value" = strRandom & UploadRequest.Item(GP_curKey).Item("FileName"

Does this clear up anything for you?

Martha Graham
Replied 23 Oct 2002 14:28:53
23 Oct 2002 14:28:53 Wayne Hultum replied:
'Save all uploaded files
if UploadRequest.Item(GP_curKey).Item("FileName" &lt;&gt; "" Then <b>UploadRequest.Item(GP_curKey).Item("value" = strRandom & UploadRequest.Item(GP_curKey).Item("FileName"</b>
*** CODE DELETEC ***
end if this is line 207

<b>Martha put that line of code in see code above and when i preview i get the message</b>

Microsoft VBScript compilation error '800a0400'

Expected statement

/swapdj/myequipment.asp, line 207

end if
^

can you see wher I'm going wrong
thanx
Replied 23 Oct 2002 14:56:20
23 Oct 2002 14:56:20 George Petrov replied:
HI Wayne,

I wonder why you want to create your own unique filenames - as this functionality is already provided in Pure ASP Upload 2

Just choose in the filename handling drop down: Make Unique

This will result in unique filenames for each new upload, so no old files will be overwriten.

Also the new filenames will be stored for you in the database automatically.

Greetings,
George

-----------------------------------------------
George Petrov - Co-Founder, www.UDzone.com
The site for Macromedia
Dreamweaver UltraDev Developers!
-----------------------------------------------
Replied 23 Oct 2002 18:35:41
23 Oct 2002 18:35:41 Wayne Hultum replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
HI Wayne,

I wonder why you want to create your own unique filenames - as this functionality is already provided in Pure ASP Upload 2

Just choose in the filename handling drop down: Make Unique

This will result in unique filenames for each new upload, so no old files will be overwriten.

Also the new filenames will be stored for you in the database automatically.

Greetings,
George

-----------------------------------------------
George Petrov - Co-Founder, www.UDzone.com
The site for Macromedia
Dreamweaver UltraDev Developers!
-----------------------------------------------
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Thank you all for your help, it's sorted now

Reply to this topic