/**
  * 文件上传
  */
 public function actionUpload()
 {
     $uploader = new Uploader();
     if (Yii::app()->request->isPostRequest) {
         //断点上传
         $uploader->initSimple('kindeditor')->uploadSimple('kindeditor_file');
         $error = $uploader->getError();
         if (!$error) {
             //返回kindeditor接收的json格式
             exit(CJSON::encode(array('error' => 0, 'url' => Helper::getFullUrl($uploader->file_path))));
         } else {
             exit(CJSON::encode(array('error' => 0, 'message' => $error)));
         }
     }
 }
 public function run()
 {
     $uploader = new Uploader();
     if (Yii::app()->request->isPostRequest) {
         //普通上传
         $uploader->initSimple('album')->uploadSimple('simple_file');
         $error = $uploader->getError();
         if (!$error) {
             $data = array('file_name' => $uploader->file_name, 'file_path' => $uploader->file_path, 'file_path_full' => Helper::getFullUrl($uploader->file_path), 'thumb_path' => $uploader->thumb_path, 'thumb_path_full' => Helper::getFullUrl($uploader->thumb_path), 'file_ext' => $uploader->file_ext);
             App::response(200, 'success', $data);
         } else {
             App::response(101, $error);
         }
     }
 }
 public function run()
 {
     $uploader = new Uploader();
     if (Yii::app()->request->isPostRequest) {
         //断点上传
         $uploader->initResumable('album')->uploadResumable('file');
         $error = $uploader->getError();
         if (!$error) {
             $data = array('file_name' => $uploader->file_name, 'file_path' => $uploader->file_path, 'file_path_full' => Helper::getFullUrl($uploader->file_path), 'file_ext' => $uploader->file_ext);
             App::response(200, 'success', $data);
         } else {
             App::response(101, $error);
         }
     } else {
         //校验已上传的片段
         $uploader->checkExistChunks();
     }
 }
Exemple #4
0
    ?>
                    <?php 
    foreach ($imageList as $img) {
        ?>
                        <li>
                            <img src="<?php 
        echo Helper::getFullUrl($img);
        ?>
" width="100px" height="100px">
                            <input type="hidden" value="<?php 
        echo $img;
        ?>
" name="imagelist[]">
                            <div class="clear">
                                <a href="<?php 
        echo Helper::getFullUrl($img);
        ?>
" class="left" target="_blank">[查看]</a>
                                <a href="javascript:;" class="right" onclick="deleteFile(this)">[删除]</a>
                            </div>
                        </li>
                    <?php 
    }
    ?>
                <?php 
}
?>
            </ul>
        </td>
    </tr>
Exemple #5
0
    echo $row->id;
    ?>
"><?php 
    echo $row->id;
    ?>
</td>
                <td>
                    <a href="<?php 
    echo Helper::getFullUrl($row->file_name);
    ?>
" target="_blank">
                        <?php 
    if (in_array($row->file_ext, array('jpg', 'png', 'bmp', 'gif'))) {
        ?>
                        <img src="<?php 
        echo Helper::getFullUrl($row->file_name);
        ?>
" alt="<?php 
        echo $row->real_name;
        ?>
" width="70"  height="70" title="<?php 
        echo $row->real_name;
        ?>
"/>
                        <?php 
    } else {
        ?>
                            <?php 
        echo $row->real_name;
        ?>
                        <?php 
Exemple #6
0
?>
</th>
                <th width="8%"><?php 
echo Yii::t('admin', 'Operate');
?>
</th>
            </tr>
        </thead>
        <?php 
foreach ($datalist as $dk => $row) {
    ?>
            <?php 
    $type = ModelType::model()->findByPk($row->type);
    if ($type) {
        $type_name = $type->type_name;
        $view_url = Helper::getFullUrl($this->createUrl('/' . $type->type_key . '/view', array('id' => $row->content_id)));
    } else {
        $type_name = '未知';
        $view_url = 'javascript:alert("数据错误");';
    }
    ?>
            <tr class="tb_list">
                <td><input type="checkbox" name="id[]" value="<?php 
    echo $row->id;
    ?>
" /><?php 
    echo $row->id;
    ?>
</td>
                <td><input name="sortOrder[<?php 
    echo $row->id;
Exemple #7
0
      <td>
            <input name="img_banner" id="special_banner" type="hidden" value="<?php 
echo $model->img_banner;
?>
"/>
            <input name="simple_file" id="fileupload_banner" onclick="fileUpload()" type="file" />
            <div id="banner_preview">
            <?php 
if ($model->img_banner) {
    ?>
            <a href="<?php 
    echo Helper::getFullUrl($model->img_banner);
    ?>
" target="_blank">
                <img style="max-width: 900px; max-height: 300px; padding:5px; border:1px solid #cccccc;" src="<?php 
    echo Helper::getFullUrl($model->img_banner);
    ?>
" align="absmiddle" />
            </a>
            <?php 
}
?>
     
      </td>
    </tr>

    <!-- 专题简介 -->
    <tr>
        <td class="tb_title"><?php 
echo $form->label($model, 'introduce');
?>
Exemple #8
0
                <?php 
if ($model->video_file) {
    ?>
           
                    <li>
                        <span style="color:green"><?php 
    echo end(explode('/', $model->video_file));
    ?>
</span>
                        <input type="hidden" value="<?php 
    echo $model->video_file;
    ?>
" name="video_file">
                        <div class="clear">
                            <a href="<?php 
    echo Helper::getFullUrl($model->video_file);
    ?>
" class="left" target="_blank">[查看]</a>
                            <a href="javascript:;" class="right" onclick="deleteFile(this)">[删除]</a>
                        </div>
                    </li>           
                <?php 
}
?>
            </ul>
        </td>
    </tr>

    <tr>
        <td class="tb_title">
            <?php 
Exemple #9
0
                <?php 
if ($model->soft_file) {
    ?>
           
                    <li>
                        <span style="color:green"><?php 
    echo pathinfo($model->soft_file, PATHINFO_BASENAME);
    ?>
</span>
                        <input type="hidden" value="<?php 
    echo $model->soft_file;
    ?>
" name="soft_file">
                        <div class="clear">
                            <a href="<?php 
    echo Helper::getFullUrl($model->soft_file);
    ?>
" class="left" target="_blank">[查看]</a>
                            <a href="javascript:;" class="right" onclick="deleteFile(this)">[删除]</a>
                        </div>
                    </li>           
                <?php 
}
?>
            </ul>
        </td>
    </tr>

    <tr>
        <td class="tb_title"><?php 
echo $form->label($model, 'language');
Exemple #10
0
            <input name="logo" type="hidden" id="logo" value="<?php 
echo $model->logo;
?>
"/>            
            <input name="simple_file" id="fileupload" onclick="fileUpload()" type="file" />
            <div id="img_logo" style="padding:10px;">
                <?php 
if ($model->logo) {
    ?>
                    <span>LOGO:</span>
                    <a href="<?php 
    echo Helper::getFullUrl($model->logo);
    ?>
" target="_blank">
                        <img style="max-width:600px; padding: 5px; border: 1px solid #cccccc;" src="<?php 
    echo Helper::getFullUrl($model->logo);
    ?>
" align="absmiddle" />
                    </a>
                <?php 
}
?>
                
            </div>
        </td>
    </tr>
    <tr>
        <td class="tb_title"><?php 
echo $form->label($model, 'sort_order');
?>
:</td>