FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Making some things vars





m-productions
Ok i have this code, and it works fine.

Code:
<?php
//create the directory if doesn't exists (should have write permissons)
if(!is_dir("./files")) mkdir("./files", 0777);
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);
?>


However, when it comes to mixing vars with strings, i get all confused when it comes to PHP.

Basicly everywhere it says "./files/" or whatnot, I want that to be a var instead. bsaicly im going to have a var called $location and i want that to take the place of files... so im thinking something like this

Code:
<?php
//create the directory if doesn't exists (should have write permissons)
if(!is_dir($location)) mkdir($location, 0777);
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], $location.$_FILES['Filedata']['name']);
?>


but knowing me, that will be full of errors.
mathiaus
That should work so long as you remember to to include
Code:
$location = './files/';
m-productions
ok, i ran into a problem, when sending the vars from flash, you cant have "/" in the var to send... sooo now i have to mix up stings in var in 1 line to make it work..and this is where php confuses the crap out of me.. in flash its so easy, you just use + xD.... but in php theres all this ' and . errr
mathiaus
So you want files in an original var?
Code:
$location = './'.$flash_var.'/';


or just
Code:
if(!is_dir('./'.$flash_var.'/')) mkdir("./files", 0777);
m-productions
perfect, thank you very much for your time! and now that i finally got this to work... i run into another problem that halts my progress... ohwell.
Related topics
Selling Sigs
Me Thinks....
sims 2 -nightlife , review
islam is...
you hear about the news of wwe player was dead? (Wrestling)
Career Guidance.
what license type is your photoshop CS2?
anyone like post-rock?
Texas Al: Modern Don Qixote! (non fiction)
Raido Control Stuff
Stem Cell Research
Invisibility cloak patented !
10 Things I've learnt in 2 weeks
What gives you the best fealing money or making things?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.