module

Drupal 6: How to Change Filename on Upload

I want to rewrite the file name when a user uploads a file. How on earth do you do that?

There appears to be very little documentation on this, so I present to you my solution, and an explanation of how I figured this out. Hopefully this will help a stranded Drupaler out there.

The Code Snippet

The following code will rewrite an uploaded file's filename from to 1234567890_<timestamp>, where "1234567890" is the timestamp.

Insert this into a custom module:

Subscribe to RSS - module