BloodDragon -
Joined: 12 Aug 2007 Posts: 1
|
Posted: Sun Aug 12, 2007 6:47 pm Post subject: PHP upload directory |
|
|
I am currently using Abyss Web Server X1 for testing my website offline. I've been trying to use an easy php script for uploading. The problem I'm having is that when a file is uploaded to a relative location, the file is saved to the php program files folder, instead of the scripts directory.
How can I save an uploaded file to a specific directory in my website location, without giving the exact location of the upload directory, but using a relative path?
This is my test-script:
Code: |
<?php
if (($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/pjpeg")
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] == 0)
{
$targetPath = "./" . $_FILES["file"]["name"];
if (!file_exists($targetPath))
move_uploaded_file($_FILES["file"]["tmp_name"], $targetPath);
}
}
?>
|
|
|