2014-01-16 99 views
0

這是一直在困擾着我很多年。我正在使用blueimp的上傳系統,它工作得很好。下面我將張貼代碼我認爲是有關我的問題:在blueimp的jquery文件上傳器中訪問文件上傳數組

當我print_r($files)這是我得到的結果:

Array 
(
    [0] => stdClass Object 
     (
      [name] => 16-01-14_QE5YHS.jpg 
      [size] => 984576 
      [type] => image/jpeg 
      [url] => http://www.summersproperty.com/dashboard/uploads/HNI3Q3/16-01-14_QE5YHS.jpg 
      [thumbnailUrl] => http://www.summersproperty.com/dashboard/uploads/HNI3Q3/thumbnail/16-01-14_QE5YHS.jpg 
      [deleteUrl] => http://www.summersproperty.com/dashboard/uploads/?file=16-01-14_QE5YHS.jpg 
      [deleteType] => DELETE 
     ) 

) 

的$文件陣列設置在這裏,我相信:

$files = array(); 
     if ($upload && is_array($upload['tmp_name'])) { 
      // param_name is an array identifier like "files[]", 
      // $_FILES is a multi-dimensional array: 
      foreach ($upload['tmp_name'] as $index => $value) { 
       $files[] = $this->handle_file_upload(
        $upload['tmp_name'][$index], 
        $file_name ? $file_name : $upload['name'][$index], 
        $size ? $size : $upload['size'][$index], 
        $upload['type'][$index], 
        $upload['error'][$index], 
        $index, 
        $content_range 
       ); 
      } 
     } 

它也返回一個JSON響應是:

{"files":[{"name":"16-01-14_QE5YHS.jpg","size":984576,"type":"image\/jpeg","url":"http:\/\/www.summersproperty.com\/dashboard\/uploads\/HNI3Q3\/16-01-14_QE5YHS.jpg","thumbnailUrl":"http:\/\/www.summersproperty.com\/dashboard\/uploads\/HNI3Q3\/thumbnail\/16-01-14_QE5YHS.jpg","deleteUrl":"http:\/\/www.summersproperty.com\/dashboard\/uploads\/?file=16-01-14_QE5YHS.jpg","deleteType":"DELETE"}]} 

我需要提取16-01-14_QE5YHS.jpg從數組中使用的腳本即時通訊編寫。我試過echo $files[0]['name'];。我敢肯定它的東西簡單,但我很困惑

回答

0

是這樣的訪問:

$files[0]->name 
相關問題