Ben bu kodu kullanarak bir dosyayı yüklediğinizde, (ne istiyorsunuz) "yüklenenler" klasöründeki dosyanın bir kopyasını koyar ama o da benim kökünde bir kopyasını koyar. Ben sadece yüklenenler klasörüne giderek dosyalarını istiyorum.
define ('GW_UPLOADPATH', 'uploads/');
$upfile= GW_UPLOADPATH . $_FILES['userfile']['name'];
if(is_uploaded_file($_FILES['userfile']['tmp_name']))
{
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $upfile)) //this is saying if the file isn't moved to $upfile.
{
echo 'Problem: could not move file to destination directory';
exit;
}
}
else
{
echo 'Problem: Possible file upload attack. Filename: '; //this could be an attack b/c it might be from localhost.
echo $_FILES['userfile']['name'];
exit;
}
echo 'File uploaded successfully<br><br>';