Forums

This topic is locked

Rename Uploaded Files (More than one)

Posted 15 Jan 2003 10:26:27
1
has voted
15 Jan 2003 10:26:27 Stewart Bond posted:
I apologise now if I have missed something from the tutorials.

I am constructing a page that uploads four images and they all need to be renamed. I am using a UserID and I want to add numbers in sequence at the end to make each name unique i.e. Myfile_333_1.gif Myfile_333_2.gif etc. I cannot do this using the extension.

Can you help?

Thanks

Stewart

Replies

Replied 15 Jan 2003 10:38:13
15 Jan 2003 10:38:13 Martha Graham replied:
Are you trying to pull the UserID from the database to rename the file?

The record needs to be saved first and the renaming is done before the record is saved in the database.

Martha Graham
Replied 15 Jan 2003 12:17:45
15 Jan 2003 12:17:45 Stewart Bond replied:
The UserID is taken from a recordset when the page is opened, into a hidden field. Then it is used to construct the name of the image.
The present string for the naming is:
RUF_renameMask = "hr_" & UploadFormRequest("UserID" & ".##ext##" (this is without any sequential numbering)

Stewart
Replied 15 Jan 2003 13:38:48
15 Jan 2003 13:38:48 George Petrov replied:
Well this should work. Are you getting any errors? or isn't the renaming done right?

George

--------------------------------------------------
George Petrov - Founder of the Dynamic Zones
DMXzone.com, FWzone.net, FLzone.net, CFzone.net,
DNzone.com, FlashFreaks.nl
--------------------------------------------------
Replied 15 Jan 2003 13:58:58
15 Jan 2003 13:58:58 Stewart Bond replied:
Hi George

Yes, it does work, but not with four images uploaded. I get the following error message. I have tried using the 'make unique' facility, but I still get the same message.

Error Type:
Microsoft VBScript runtime (0x800A003A)
File already exists
/4uGroup/ScriptLibrary/incPUAddOn.asp, line 122

The first image is renamed as the string indicated previously, but the rest are just uploaded with the original name (i.e. image_1.gif, image_2.gif, image_3.gif and image_4.gif upload as hr_333.gif, image_2.gif, image_3.gif and image_4.gif) and no information is inserted into the database (I know this will not happen until it can get past the upload sequence).

Stewart
Replied 15 Jan 2003 15:57:56
15 Jan 2003 15:57:56 Martha Graham replied:
Are you setting the conflict handling to make unique? In the Pure ASP Upload extension?

Martha Graham
Replied 15 Jan 2003 16:01:17
15 Jan 2003 16:01:17 Stewart Bond replied:
Martha

Yes I am, but I still get the same error message.

Stewart
Replied 16 Jan 2003 11:23:40
16 Jan 2003 11:23:40 George Petrov replied:
well unfortunately the Rename extension does not handle also filename resolution - ie making the names also unique.

So if the new filename that is generated - already exists - you will get an error ...

We just don't have this feature in current Rename extension.
We will add it in the next version however. But it might take a while.

Greetings,
George

--------------------------------------------------
George Petrov - Founder of the Dynamic Zones
DMXzone.com, FWzone.net, FLzone.net, CFzone.net,
DNzone.com, FlashFreaks.nl
--------------------------------------------------
Replied 10 Nov 2005 13:45:51
10 Nov 2005 13:45:51 kiru Good replied:
Hi i put this code to generate a unike radon filename, but the problem i had now that i can not save into the database....Can you help me with that?

<%
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim objT ' As Object
Set objT = CreateObject("Scriptlet.TypeLib"
Dim strT ' As String
strT = CStr(objT.Guid)
strT = Replace(strT, "{", ""
strT = Replace(strT, "-", ""
strT = Replace(strT, "}", "_##name##.##ext##"
End If
%>
<%
' *** Rename Uploaded Files 1.5.0
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim RUF_path, RUF_renameMask
RUF_path = "../../../../upload/sticc/mensajes"
RUF_renameMask = strT
RenameUploadedFiles RUF_path,RUF_renameMask
end if
%>

Reply to this topic