|
|
#1 |
|
php rename file problem
this is probably a simple problem, but the solution seems to be escaping me at the moment.
(edited cause my original idea was dumb) PHP Code:
__________________
: 13in MBP, MDD FW800, iMac g3 slot loading, iBook g4 PC: Custom build(main), IBM Intellistation p4, Dell latitude pIII Last edited by hansolo669; Feb 28, 2012 at 04:19 PM. |
|
|
|
0
|
|
|
#2 |
|
If I'm understanding your question, replace the $_FILES["file"]["name"] variable with the variable that contains the name you want to save it as.
So if $newname contains the new file name you want to save it as, your code would be PHP Code:
__________________
-PPC_Michael Apple is just a company. Think for yourselves. |
|
|
|
1
|
|
|
#3 | |
|
Quote:
my actualy code ended up as such: PHP Code:
__________________
: 13in MBP, MDD FW800, iMac g3 slot loading, iBook g4 PC: Custom build(main), IBM Intellistation p4, Dell latitude pIII |
||
|
|
0
|
|
|
#4 |
|
Looks good! By the way, instead of the curly brackets you could also do:
PHP Code:
__________________
-PPC_Michael Apple is just a company. Think for yourselves. |
|
|
|
0
|
|
|
#5 | |
|
Quote:
PHP Code:
1 - "simple" variable name, in the form of $variablename. E.g., not $foo['bar'] or $foo->bar 2 - double quotes. 'images2012/$newname' won't work, because single-quoted aren't run through the parser. which, incidentally, is why you should use single quotes for most strings (unless you need variable replacement, or some non-printing characters, e.g., \n) -- less processing overhead.
__________________
Mac Pro; Aluminum iMac; Mac Mini (x2); Macbook Pro; iPad; iPhone 4; TV 2 (x2); G4 Tower
|
||
|
|
-1
|
|
|
#6 | |
|
Quote:
![]() thank you, incidentally i was wondering what the difference was between single and double quotes, and now i know!
__________________
: 13in MBP, MDD FW800, iMac g3 slot loading, iBook g4 PC: Custom build(main), IBM Intellistation p4, Dell latitude pIII |
||
|
|
0
|
|
|
#7 | |
|
Quote:
I will say that, while my example above works fine, stylistically, I'm not a big fan of multiple variables in double quotes like that. In other words, I'm okay with this: PHP Code:
PHP Code:
For multiple variables, I generally do it similar to the way ppc_michael described. PHP Code:
Also, the performance increase is so small as to be imperceptible. IMO, unless you're dealing with tens of thousands of strings, and need to wrangle every absolute micro-second out of your code, it's probably best to just to stick with double-quotes. You get the variable extraction / escaping as needed, and can be consistent in your code.
__________________
Mac Pro; Aluminum iMac; Mac Mini (x2); Macbook Pro; iPad; iPhone 4; TV 2 (x2); G4 Tower
|
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Renaming files in OS X 10.7 Lion | benjancewicz | Mac OS X 10.7 Lion | 5 | Mar 31, 2012 12:19 PM |
| Folder problem - renaming/accessing | Rory Bhoy | Mac Basics and Help | 1 | Jul 31, 2011 12:35 PM |
| PHP/HTML File Editor Problems | geekindisguise | Web Design and Development | 2 | Jan 15, 2009 08:18 AM |
| In a php include /file.php doesn't work... | MegaMan1311 | Web Design and Development | 9 | Jul 10, 2008 02:09 PM |
| Finder, File Chooser, Rename Files?? | chelsel | Mac OS X | 2 | Sep 23, 2007 04:15 PM |
All times are GMT -5. The time now is 09:13 AM.








TV 2 (x2); G4 Tower

Linear Mode

