Prefix File Rename

See all posts Reply

Prefix File Rename new!
by John, 14 years, 10 months ago
Can you please advise if I can prefix a file name with underscore?

Example

Input
filename: sample.jpg

Output
/images/sample.jpg
/images/_thumbs/_sample.jpg

I have tried file_name_body_add but this appends after - not before original filename.

ThanksReply
Re: Prefix File Rename new!
by colin, 14 years, 10 months ago
Yes, you can.

Before calling process(), you can read $handle->file_src_name_body. Then, you set $handle->file_new_name_body

For instance, do:
$handle = new Upload(......);
if ($handle->uploaded) {
  $handle->file_new_name_body = '_' . $handle->file_src_name_body;
  $handle->Process(.......);
  // .......
}
Reply
Re: Prefix File Rename new!
by John, 14 years, 9 months ago
Thanks for your prompt assistance - worked well for me.Reply