Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php从flash上传图像更具体地说是HTTP_RAW_POST_数据?_Php_Flash_Upload_Directory - Fatal编程技术网

使用php从flash上传图像更具体地说是HTTP_RAW_POST_数据?

使用php从flash上传图像更具体地说是HTTP_RAW_POST_数据?,php,flash,upload,directory,Php,Flash,Upload,Directory,我目前正在使用它,因此它会显示一个对话框以将图像保存到您的计算机上: if (isset($GLOBALS["HTTP_RAW_POST_DATA"])) { // get bytearray $jpg = $GLOBALS["HTTP_RAW_POST_DATA"]; // add headers for download dialog-box header('Content-Type: image/jpeg'); header("Content-Disposition: attachme

我目前正在使用它,因此它会显示一个对话框以将图像保存到您的计算机上:

if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{

// get bytearray
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];

// add headers for download dialog-box
header('Content-Type: image/jpeg');
header("Content-Disposition: attachment; filename=".$_GET['name']);
    echo $jpg;
}
只是想知道是否有任何方法可以直接将文件放入目录/文件,而不需要对话框


像上传者一样?

不,没有。

只需读取页面内容并使用fopen、fwrite e.t.c.保存在文件中即可

if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){

    // get bytearray
    $jpg = $GLOBALS["HTTP_RAW_POST_DATA"];

    // add headers for download dialog-box
 ob_start();
    header('Content-Type: image/jpeg');
       echo $jpg;
  $image=ob_get_clean();
   //and here write it into file      
  }
或者下面是我的代码,你可以删除不必要的东西,对你没有用处

 if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] ))     {
$im = $GLOBALS["HTTP_RAW_POST_DATA"];
$filename=$_GET['name'];
$fullFilePath='files/'.$filename;
$handle=fopen($fullFilePath,"w");
fwrite($handle,$im);
fclose($handle);
$returnVars = array();
$returnVars['write'] = "yes";
$returnString = http_build_query($returnVars);
//send variables back to Flash
echo $returnString;
  }

使用http原始post数据上传有什么方法吗?没有。使用http原始post数据与下载无关。你把下载和上传搞砸了。您正在使用HTTP_RAW_POST_数据将文件从用户发送到服务器(上载),并使用echo将其发送回服务器(下载)。但这并不重要,因为在没有用户许可的情况下,您无法在用户的计算机上保存文件。时期