tags:

views:

24

answers:

1
<?php

    if($_FILES['Filedata']['size']>=520000)
    {
     echo "\n Sorry, Not Moved Size below 5.2kb or 5200 bytes Only\n";
     return;
    }
    $ext = end(explode('.', strtolower($_FILES['Filedata']['name'])));

    if(move_uploaded_file($_FILES['Filedata']['tmp_name'], "./".$_FILES['Filedata']['name']))
    {
     echo "\nfile moved Success\n";
     return;
    }
?>

When i set path, it does not work... i dont know where to exactly set path such that the file gets saved in the directory.

+1  A: 

See the move_uploaded_file documentation.

The first argument ($_FILES['Filedata']['tmp_name']) is the source, which you shouldn't change. The second argument ("./".$_FILES['Filedata']['name']) is the destination, which will currently put the file in the current working directory with its original name (This can be a security issue; you should put the file in an upload directory that has no execute permissions.)

Blixt