...
|
...
|
@@ -106,8 +106,9 @@ class Images |
|
|
/**
|
|
|
* 图片上传
|
|
|
* @param string $name 文件表单name, 即用于$_FILES[$name]
|
|
|
* @param string $path
|
|
|
*/
|
|
|
public static function saveImage($name)
|
|
|
public static function saveImage($name, $path = 'suggest')
|
|
|
{
|
|
|
if (empty($_FILES[$name])) {
|
|
|
return array();
|
...
|
...
|
@@ -124,7 +125,7 @@ class Images |
|
|
$images[$files['name']] = $files['tmp_name'];
|
|
|
}
|
|
|
|
|
|
return self::uploadStreamImage($images);
|
|
|
return self::uploadStreamImage($images, $path);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -132,9 +133,10 @@ class Images |
|
|
*
|
|
|
* @param string | array(filename => absolute file path) $file
|
|
|
* url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
|
|
|
* @param string $path
|
|
|
* @return mixed
|
|
|
*/
|
|
|
public static function uploadStreamImage($file)
|
|
|
public static function uploadStreamImage($file, $path = 'suggest')
|
|
|
{
|
|
|
$end = "\r\n";
|
|
|
$twoHyphens = "--";
|
...
|
...
|
@@ -158,7 +160,7 @@ class Images |
|
|
$stream .= $twoHyphens . $boundary . $end;
|
|
|
$stream .="Content-Disposition: form-data; " . "name=\"project\"" . $end;
|
|
|
$stream .= $end;
|
|
|
$stream .= "suggest"; //project sns
|
|
|
$stream .= $path; //project sns
|
|
|
$stream .= $end;
|
|
|
$stream .= $twoHyphens . $boundary . $twoHyphens . $end;
|
|
|
$opts = array(
|
...
|
...
|
|