php upload questions --move_uploaded_file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all:

I meet a very strange problem about php upload.
Usually, we use move_uploaded_file to  upload, but it could not work in
flex use php to upload.
Same Php upload code can work in html page, and move_uploaded_file
function  will return 1;
But it  could not work in flex, and move_uploaded_file  function  return
nothing.
I wonder if PHP have some restriction?  Has anyone meet such problems?
Thank you very much!


Flex upload code:
                  file = new FileReference();
                  ......
                  var request:URLRequest = new
URLRequest("http://www.a.com/upload.php";);
.......
                  file.upload(request);

Php code:

<?php

    $uploadFolder = $_SERVER['DOCUMENT_ROOT']."/previews/order/"; //
upload folder
    $destFileName = $_REQUEST['fileName'];
    $dest = $uploadFolder.$destFileName;
    
    if (sizeof($_FILES)==0) {
                echo "no file";
    }
    
    $f=array_pop($_FILES);            
    echo $f['tmp_name']."<br>"  ;
   error_log($uploadFolder."\r\n", 3,
$_SERVER['DOCUMENT_ROOT']."/FileService.log");
    error_log($f['tmp_name'].'::'.$f['name']."\r\n", 3,
$_SERVER['DOCUMENT_ROOT']."/FileService.log");    
    error_log((is_uploaded_file($f['tmp_name'])?"true":"false")."\r\n",
3, $_SERVER['DOCUMENT_ROOT']."/FileService.log");     //////// return
true here!
    
    echo $dest;
   $r = move_uploaded_file($f['tmp_name'],$dest);

   error_log("uploadresult--".$r."--\r\n", 3,
$_SERVER['DOCUMENT_ROOT']."/FileService.log");
  chmod($dest,0777);     
?>
Thank!
Luna

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux