28, May 2012

Add prefix to filename - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Add prefix to filename
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Add prefix to filename  (Read 2048 times)
Just another rainy day
*
Posts: 1
10 credits
Members referred : 0


« on: Jul 26, 2006, 04:23:12 pm »

Hi! Thanks for the snipplet. I'm trying out multiple uploads using the example provided. I would like to rename the uploaded file by adding a prefix "abc_". I tried to work on the part where we rename filename to date stamp by changing strtotime("now") to $prefix.$the_file. The prefix shows up but not the original filename. What variable should I use for the original filename?

Code:
function set_file_name($new_name = "") { // this "conversion" is used for unique/new filenames
if ($this->rename_file) {
if ($this->the_file == "") return;
$name = ($new_name == "") ? strtotime("now") : $new_name;
sleep(3);
$name = $name.$this->get_extension($this->the_file);
} else {
$name = str_replace(" ", "_", $this->the_file); // space will result in problems on linux systems
}
return $name;
}
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 26, 2006, 05:16:51 pm »

Hello,

the multi upload is just a simple example the renaming function doesn't work with this example. You need to build your own loop to upload multiple renamed files, check this thread too: http://www.webdigity.com/index.php/topic,3015.0.Multiple+file+upload+%26amp%3B+storing+filenames.html


EDIT: don't change class files extend them otherwise you struggle with later updates!

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3412
Tags : linux Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Add prefix to filename
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:33:18 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.