LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-25-2002, 09:12 AM   #1
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
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.
 
Old 08-26-2002, 10:37 AM   #2
no2nt
Member
 
Registered: Aug 2001
Location: South Carolina, USA
Distribution: Redhat 8.0/Custom
Posts: 96

Rep: Reputation: 16
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()
 
Old 08-26-2002, 11:10 AM   #3
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Original Poster
Rep: Reputation: 30
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.
 
Old 08-26-2002, 11:59 AM   #4
no2nt
Member
 
Registered: Aug 2001
Location: South Carolina, USA
Distribution: Redhat 8.0/Custom
Posts: 96

Rep: Reputation: 16
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";
}

?>

Last edited by no2nt; 08-26-2002 at 12:00 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP upload file to other server antony_csf Programming 13 02-04-2005 04:11 AM
file upload with php+libcurl via POST Cupacabra Linux - Software 0 01-12-2005 01:53 PM
client can`t upload file, can reply email verchrom Linux - Newbie 8 06-17-2003 02:56 PM
File upload via PHP saravanan1979 Programming 1 02-14-2002 05:28 AM
File upload via PHP!!! saravanan1979 Programming 0 02-14-2002 02:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration