LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP: upload file to client... (https://www.linuxquestions.org/questions/programming-9/php-upload-file-to-client-28742/)

ugenn 08-25-2002 08:12 AM

PHP: upload file to client...
 
How does one upload a file to a client in PHP? I'm trying
to implement the following...
user clicks on link (with encoded filepath).
- script validates user
- script validates path
- local path is concatenated with the input path to
locate the file on the local filesystem
- check if the file exists
- how do I send the file to the client.

no2nt 08-26-2002 09:37 AM

Here's the goodies, example and all:

http://www.php.net/manual/en/features.file-upload.php

also look at is_uploaded_file() and move_uploaded_file()

ugenn 08-26-2002 10:10 AM

Re: PHP: upload file to client...
 
Quote:

Originally posted by ugenn
How does one upload a file to a client in PHP? I'm trying
to implement the following...
user clicks on link (with encoded filepath).
- script validates user
- script validates path
- local path is concatenated with the input path to
locate the file on the local filesystem
- check if the file exists
- how do I send the file to the client.

Thanks but that's not what I was really asking.
I'm trying to send from server to client not the other way around.
I figured it had to do with modifying the HTTP header with header() but I can't figure out the exact strings to put into the header() call.

no2nt 08-26-2002 10:59 AM

Oh, my bad.
To send a zip file...

Code:

<?php

// verify user
// verify file

if( $everythingIsOk)
{
    header("Content-type: application/zip\n\n");
    // push file to browser here
}
else
{
    echo "Ha! Bad things have happened!\n";
}

?>



All times are GMT -5. The time now is 08:05 PM.