Give The File a Static Name
Question:
I needed to rename the file accordingly after the page name, since this was going to be a updatable frontpage,
Answer:
What you do is insert the Pure ASP Upload and insert to database as usuall, you can skip the insert into database if you want to.
This is what you change
'Create and Write to a File
GP_curPath = Request.ServerVariables("PATH_INFO")
GP_curPath = Trim(Mid(GP_curPath,1,InStrRev(GP_curPath,"/")) & UploadDirectory)
if Mid(GP_curPath,Len(GP_curPath),1) <> "/" then
GP_curPath = GP_curPath & "/"
end if
GP_CurFileName = "front.jpg"
GP_FullFileName = Trim(Server.mappath(GP_curPath))& "\" & GP_CurFileName
'Check if the file alreadu exist
change the varible GP_CurFileName to what ever you want and whoops
you've got your same filename
DISCLAIMER:
This is extra complimentary content which purpose is to show additional usage that is not part of the product, i.e. it suggests tips for extending the functionality of the product by the users themselves.
It is provided "as is", without warranty of any kind, express or
implied , including but not limited to the warranties of
merchantability, fitness for a particular purpose and nonfringement of
third party rights.
DMXzone does not take responsibility to
support the suggested content to be fully compatible and working as
intended and does not provide support for extended functionality which
is not included in the current release of the extension.
It is highly recommended that only more advanced developers use it.
Comments
I cant get this to work at all!
Williamchill@hotmail.com
"dynamic file name"
I was able to get the above code to work by using:
UploadRequest.Item(GP_curKey).Item("FileName") = "image.jpg"
However, I'd like the image name to be the value of one of the other fields I'm submitting, like:
UploadRequest.Item(GP_curKey).Item("FileName") = LastName & ".jpg" where LastName is a form field name.
How can I accomplish this?
RE: Hmm
I think it was
lastname = uploadrequest"thefield"
File Type
You must me logged in to write a comment.