Re: php upload questions --move_uploaded_file

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

 



    Hai,

    I'm forwarding this email over to the PHP-General list, since it's
not database-related.  If you're not already subscribed there, please
subscribe and I'm sure you'll get some responses.

    ORIGINAL MESSAGE FOLLOWS:

On Thu, Jun 26, 2008 at 6:21 AM, Liu, Hai Tao (Taylor)
<htliu@xxxxxxxxxxxxx> wrote:
> 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
>
>



-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
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