MyBB Community Forums

Full Version: add prefix in attachment
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to add prefix in attachment.
Can you expand on what you mean?
Ok just think attachment name is love me.flv after upload i want it will be mysite.com_love me.flv
I still don''t understand your request. By default, below is your attachment string that is used to generate the ID of each attachment.

<a href="attachment.php?aid={$attachment['aid']}" target="_blank">

Do you mean you want to add a prefix where it shows uploaded attachments in posts?

EDIT:

I just re-read your post and I think you mean that you want the file name to be displayed in the download URL, so instead of

http://www.yoursite.com/attachment.php?aid=x

you'd want

http://www.yoursite.com/filename.zip

Attachments are stored in a database and I think that the global variables used to manage them such as the aid=x or Attachment ID is hard coded in. I guess you'd need to use a plugin of some sort to add your own upload script to add to a specific directory and naming convention.

Although if you did this, you'd have to rework the upload attachment function along with inserting into a post and you'd need to be able to build it in to the group permissions of MyBB.

There might be an existing plugin for this, I know there's some that provide full download suites but to make the specific changes you're asking for I had no luck in my search.

There might be an easier way, so maybe a member of the support team or a developer could tell you a simple way of doing it.
No i think he wants to prefix the file name so when you download it, it would be like
google.com_FILENAME.zip

Not sure how to do that sorry
(2013-04-17, 11:38 AM)Exze Wrote: [ -> ]No i think he wants to prefix the file name so when you download it, it would be like
google.com_FILENAME.zip

Not sure how to do that sorry

Even so, MyBB's built in attachment feature handles all this. I can't see any mods or documentation on changing the naming convention, I imagine doing so would be possible however.
@Exze is right so please help

Dump!