Pages: [1]
  Print  
Author Topic: about the upload example put.php file  (Read 3604 times)
0 Members and 1 Guest are viewing this topic.
nanifrankey
Newbie
*
Posts: 25


« on: 20 May , 2009, 02:15:33 »

Hi

I am new user, try to understand the examples of upload plugin.

loadVariables("http://127.0.0.1:1001/Basic/uldl?klCommand=upload&klTrId=98761&klUrl=http://labs.kuneri.net/put.php&klFile=" add fileToUpload add"&klType=text/plain&", "/main");

this example works fine. but what is this put.php?
what special functionality it has? how can it receive the file from swf?

Logged
nanifrankey
Newbie
*
Posts: 25


« Reply #1 on: 20 May , 2009, 02:17:51 »

like this example?

<?php
/* PUT data comes in on the stdin stream */
$putdata = fopen("php://input", "r");

/* Open a file for writing */
$fp = fopen("myputfile.ext", "w");

/* Read the data 1 KB at a time
   and write to the file */
while ($data = fread($putdata, 1024))
  fwrite($fp, $data);

/* Close the streams */
fclose($fp);
fclose($putdata);
?>
Logged
nanifrankey
Newbie
*
Posts: 25


« Reply #2 on: 20 May , 2009, 06:03:34 »

I modify the example of upload file to the server.
loadVariables("http://127.0.0.1:1001/Basic/uldl?klCommand=upload&klTrId=987161&klUrl=http://www.../test.php&klFile=" add fileToUpload add"&klType=text/plain&", "/main");
      

when it is tested, it works!!but, the file is not in the server. I don't know where the file goes??
how could it happens>?
Logged
nanifrankey
Newbie
*
Posts: 25


« Reply #3 on: 20 May , 2009, 06:05:36 »

It seems , no matter what the php file is , it can send any file to somewhere.
but where?!?!?
my test.php looks like below

<?php
$content_dir = '/inc/';
$filename = Null;

if(isset($_POST['fileName'])){
    $filename = $_POST['fileName'];
}

if(isset($_FILES['klFile'])){
    if ($filename == Null){
        $filename = $_FILES['klFile']['name'];
//before the klfile is klfileupload.why??
    }

    if( !move_uploaded_file($_FILES['klFile']['tmp_name'],$content_dir . $filename) ){
        exit("Couldn't write the file in $content_dir");
    }
} else {
    // something when wrong
    exit("False");
}

// return
echo "True";

?>

Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #4 on: 21 May , 2009, 01:39:19 »

I don't know your server setup, but I'd check out these :
$content_dir  This should be publicly accessible directory (create&write rights allowed)

$_FILES['klFile'] is wrong, it must be
$_FILES['klFileUpload']

other parts are like in wiki explained
http://wiki.kunerilite.net/index.php?title=Upload/Download_plugin#Upload

Hope that helps
Logged
nanifrankey
Newbie
*
Posts: 25


« Reply #5 on: 22 May , 2009, 04:48:15 »

thank you , it works now.
Logged
Pages: [1]
  Print  
 
Jump to: