This topic is locked

rename file/image on upload

5/29/2015 6:28:59 PM
PHPRunner General questions
J
jetacera author

I am using PHPR 6.0 (I know... I need to upgrade <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=23167&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' /> ) I am working on a membership project where members will be uploading a few different files to their member account to receive the administor's approval. I want to upload the file and keep the name, but I want to add the content of another field at the beginning of the file name.
For example, the user table (memusers) has a field called "mid" with the content "143ABCQR201505141726119876" saved in a session variable. If that user uploads filename.jpg I want the file be renamed to 143ABCQR201505141726119876_filename.jpg. If they upload otherfile.pdf, I want the file to be renamed to 143ABCQR201505141726119876_otherfile.pdf. And, of course, I want the new filename to be stored in the database field rather than the original filename. I want this to work on an add/edit page (no inline add/edit), so I'm fairly certain this would go in the Before record added/Before record updated event.
I've been searching through the forums and the help file and cannot seem to locate any sample code. I found one post in the forum that looked promising, but the referenced link is broken.
Your assistance would be greatly appreciated.

Sergey Kornilov admin 5/29/2015

Here is the relevant article from PHPRunner 6.0:

http://xlinesoft.com/phprunner/docs60/rename_uploaded_file.htm