My plugin takes as an argument the id of an asset. So I'm starting from here:

   $entry = craft()->elements->getElementById($entry_id); 

Assuming my asset has the url http://mybucket.mycompany.com/uploads/pdfs/myfile.pdf, how can I return just 'uploads/pdfs/myfile.pdf' from within my plugin?

1 Answer 1


I'd just use the replace filter to chop it off...


Even if you didn't know the bucket name exactly, replace supports regex.

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.