2

I want to upload an audio file on Drupal, trim it, and save it in sites/default/files/audio/. I know how I trim the audio file; I only want to set my audio-trim-library in Drupal when the file is uploaded, and not when saved.

How can I do it?

2

My best guess is to use hook_field_presave() to alter it before it gets saved, for example:

function hook_file_presave($file) {
  // Change the file timestamp to an hour prior.
  $file->timestamp -= 3600;
}

See also: How do I change the uploaded file name after the node has been saved?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.