0
  1. I want to upload a file on my PHP server. I am currently able to upload it on server using the following code but I don't know how I can store it on the server. How can I store the file in a specific directory?

  2. I also want the users to be able to download the files but only once they log in not before that.

    For example i store the file in directory /myfiles no-one must be able to download it unless he is logged in

    e.g. someone can download the file if he knows the file location like www.example.com/temp/myfile.txt

    I don't want that - user must not be able to download it unless he is logged in.

  3. I have one page B.php in which there will be the download link. When the user clicks on that link he must be able to download the file. In short, he must get a Save as/Open pop up of browser when he clicks my link. How do I do that?

2
  • @gumbo : how do i accpe the answer posted my someone?Where is the option for that? Commented Sep 21, 2009 at 15:28
  • @unknown: Go to one of your questions and click the check mark next to a question you want to accept. Commented Sep 21, 2009 at 15:52

2 Answers 2

1

Check the PHP documentation about move_uploaded_file() here: http://de.php.net/manual/en/function.move-uploaded-file.php

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

Comments

0
function UploadData()
{
        $yourpath ="yourfoldername";
    createafolder($yourpath ); // if not present then create it (its custom function)

    $target_path = $yourpath . basename( $_FILES['fileupload']['name']); 

    if(move_uploaded_file($_FILES['fileupload']['tmp_name'], $target_path)) {
               //write if any processing
    }
            else echo "Upload sucessful!";

}

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.