Forums

ASP

This topic is locked

Renaming files with ASP Pure Upload

Posted 31 May 2006 19:01:01
1
has voted
31 May 2006 19:01:01 Kessa Thomas posted:
Hi All,

I've been trying to figure out a way to rename files when they are uploaded but can't seem to get anything to work (please bear in mind that I'm new to .asp!)

I've taken a look at the code and have been trying to use the "replace" command on filename in the following it of code (this is the original untouched version):

<pre id=code><font face=courier size=2 id=code>
'Get filename
function pau_FileName(FormInfo)
Dim PosBeg, PosLen
PosBeg = InStr(FormInfo, "filename="+10
PosLen = InStr(PosBeg, FormInfo, Chr(34))-PosBeg
pau_FileName = Mid(FormInfo, PosBeg, PosLen)
end function
</font id=code></pre id=code>

....but nothing seems to work.

What I would like to do is replace with filename with the account ref number, and the number of the image so I would end up with the following format:

ABC123p1, ABC123p2, ABC123p3, ABC123p4

(ABC123 = account reference and p1, p2, etc is the image reference)

Two questions:
1) Am I trying to make the changes to the wrong section? If so, where should I be making the changes?
2) Is it OK to rename the file at this stage (or does the script require the original file name in order to be able to upload the images?)

Any help would be really appreciated.

Thanks
Kessa

Replies

Replied 01 Jun 2006 11:28:59
01 Jun 2006 11:28:59 Patrick Woldberg replied:
If you want to edit it directly in the include file you should search for GP_FullFileName which is the variable used to save the file. Or you could rename the file afterwards by using the FileSystemObject. Also we have a rename option in our Pure ASP Upload Add-On Pack extension.

--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------

Reply to this topic