0
<?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
  • I'd appreciate some extra information. Commented Jul 13, 2009 at 6:53

1 Answer 1

1

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.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.