21, November 2008

Add prefix to filename - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ 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

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


« on: Jul 26, 2006, 05: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: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 26, 2006, 06: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 Visit through proxy


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


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3412
Tags : linux Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


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?
Nov 21, 2008, 05:30:30 AM





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!


Forum Statistics
Total Posts: 37.714
Total Topics: 7.646
Total Members: 4.390
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: panetolikos

26 Guests, 4 Users online :

20 users online today:



Readers

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