2016-05-17 5 views
0

配列内の変数を入れて、私は、配列内の変数を置くとこだわっているは、私はPHPに新たなんだ

私がやりたいすべてが見て、変数

からのファイルの場所を定義しています私の変数の下のコードは$ requested_albumですが、私は以下に入れたものが間違っていることを知っていますが、私は複数の人に尋ねると何も動作していないようです!

コードの下:)

$uploader = new Uploader(); 
     $data = $uploader->upload($_FILES['files'], array(
      'limit' => 10, //Maximum Limit of files. {null, Number} 
      'maxSize' => 10, //Maximum Size of files {null, Number(in MB's)} 
      'extensions' => null, //Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))} 
      'required' => false, //Minimum one file is required for upload {Boolean} 
      'uploadDir' => "../albums/$requested_album", //Upload directory {String} 
      'title' => array('name'), //New file name {null, String, Array} *please read documentation in README.md 
      'removeFiles' => true, //Enable file exclusion {Boolean(extra for jQuery.filer), String($_POST field name containing json data with file names)} 
      'perms' => null, //Uploaded file permisions {null, Number} 
      'onCheck' => null, //A callback function name to be called by checking a file for errors (must return an array) | ($file) | Callback 
      'onError' => null, //A callback function name to be called if an error occured (must return an array) | ($errors, $file) | Callback 
      'onSuccess' => null, //A callback function name to be called if all files were successfully uploaded | ($files, $metas) | Callback 
      'onUpload' => null, //A callback function name to be called if all files were successfully uploaded (must return an array) | ($file) | Callback 
      'onComplete' => null, //A callback function name to be called when upload is complete | ($file) | Callback 
      'onRemove' => 'onFilesRemoveCallback' //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback 
     )); 

答えて

-1

使用を助けてください。私にとってその仕事。

$requested_album = "test"; 
$arr = array(
    'limit' => 10, //Maximum Limit of files. {null, Number} 
    'maxSize' => 10, //Maximum Size of files {null, Number(in MB's)} 
    'extensions' => null, //Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))} 
    'required' => false, //Minimum one file is required for upload {Boolean} 
    'uploadDir' => "../albums/".$requested_album."/picture.jpg", //Upload directory {String} 
    'title' => array('name'), //New file name {null, String, Array} *please read documentation in README.md 
    'removeFiles' => true, //Enable file exclusion {Boolean(extra for jQuery.filer), String($_POST field name containing json data with file names)} 
    'perms' => null, //Uploaded file permisions {null, Number} 
    'onCheck' => null, //A callback function name to be called by checking a file for errors (must return an array) | ($file) | Callback 
    'onError' => null, //A callback function name to be called if an error occured (must return an array) | ($errors, $file) | Callback 
    'onSuccess' => null, //A callback function name to be called if all files were successfully uploaded | ($files, $metas) | Callback 
    'onUpload' => null, //A callback function name to be called if all files were successfully uploaded (must return an array) | ($file) | Callback 
    'onComplete' => null, //A callback function name to be called when upload is complete | ($file) | Callback 
    'onRemove' => 'onFilesRemoveCallback' //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback 
); 
echo "<pre>"; 
print_r($arr); 

出力

Array 
(
    [limit] => 10 
    [maxSize] => 10 
    [extensions] => 
    [required] => 
    [uploadDir] => ../albums/test/picture.jpg 
    [title] => Array 
     (
      [0] => name 
     ) 

    [removeFiles] => 1 
    [perms] => 
    [onCheck] => 
    [onError] => 
    [onSuccess] => 
    [onUpload] => 
    [onComplete] => 
    [onRemove] => onFilesRemoveCallback 
) 

チェックデモ:Click Here

+0

-1 plzの理由は? – RJParikh

+0

は私ではありませんでした。上記は動作しません。変数が表示されないので、ファイルはアルバムforderderに保存されます –

+0

ありがとうございました!このアルバムのように見えるようにするには/.$ requested_album/picture.jpg - requested_albumはフォルダ –

0
$arr = array(
       'limit' => 10, //Maximum Limit of files. {null, Number} 
       'maxSize' => 10, //Maximum Size of files {null, Number(in MB's)} 
       'extensions' => null, //Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))} 
       'required' => false, //Minimum one file is required for upload {Boolean} 
       'uploadDir' => "../albums/".$requested_album, //Upload directory {String} 
       'title' => array('name'), //New file name {null, String, Array} *please read documentation in README.md 
       'removeFiles' => true, //Enable file exclusion {Boolean(extra for jQuery.filer), String($_POST field name containing json data with file names)} 
       'perms' => null, //Uploaded file permisions {null, Number} 
       'onCheck' => null, //A callback function name to be called by checking a file for errors (must return an array) | ($file) | Callback 
       'onError' => null, //A callback function name to be called if an error occured (must return an array) | ($errors, $file) | Callback 
       'onSuccess' => null, //A callback function name to be called if all files were successfully uploaded | ($files, $metas) | Callback 
       'onUpload' => null, //A callback function name to be called if all files were successfully uploaded (must return an array) | ($file) | Callback 
       'onComplete' => null, //A callback function name to be called when upload is complete | ($file) | Callback 
       'onRemove' => 'onFilesRemoveCallback' //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback 
      ); 

$アップローダー=新しいアップローダ();

$ data = $ uploader-> upload($ _ FILES ['files']、$ arr);

これを使用してみてください。

関連する問題