That question is a little vague... what plussy pointed at is correct if you want to know about the php file that's currently running -- but if you have a filename or a relative path do you want the local path or the http path? (since they're two different things)... It's hard to say without more information since, well... vague. These may also be relevant to your question: http://us2.php.net/manual/en/function.parse-url.php http://us2.php.net/manual/en/function.pathinfo.php Sometimes you have to use all three in concert with each-other -- often times you'll have a local filesystem path, and need to turn it into a URL path -- which means taking $_SERVER['DOCUMENT_ROOT'] and stripping it off the start of the local path. Other times you'll have a URL path, and have to reverse it by stripping off the domain and protocol, and adding $_SERVER['DOCUMENT_ROOT'] at the start. Really, we need more information though.
This place seems overrun with these of late -- it's like we've got a upsurge of broken Engrish in five-word wonder-posters... reaching the point I want to get medieval on their tuchas' Samuel L. Jackson style... Englisc, mÅdor wyrter! GedÅn Ä“ow cweþan hit?
use it <?php if(isset($_POST['b1'])) { $path="img/"; $fn=$_FILES['f1']['name']; $path=$path.$fn; if(move_uploaded_file($_FILES['f1']['tmp_name'],$path)) { echo "The file ".$_FILES['f1']['name']. " has been uploaded"; } else { echo "There was an error uploading the file, please try again!"; } } ?> <form method="post" action="" enctype="multipart/form-data"> select<input type="file" name="f1"><br> <input type="submit" name="b1" value="upload"> </form>
Are you for real?? anyone using that code will have their server compromised from day 1, do you really think its a good idea to allow anyone to upload any type of file without checking what type of file it is? You really shouldnt be giving advice like this untill you know what the hell you are talking about, go and learn about basic server security before posting crap like this.
Yeah, Unlike the bunch of useless meaningless posts you have made on the forum just to boost your post count, i smell infractions heading your way..