<th>縮略圖:</th>
<td>
<script src="{{asset( 'resources/org/uploadify/jquery.uploadify.min.js' )}}" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{{asset( 'resources/org/uploadify/uploadify.css' )}}">
<input type="text" size="50" name="art_thumb">
<input id="file_upload" name="file_upload" type="file" multiple="true">
</td>
<script type="text/javascript">
<?php $timestamp = time();?>
$(function() {
$('#file_upload').uploadify({
// Laravel表單提交必需參數_token,防止CSRF
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'_token' : '{{csrf_token()}}',
},
'buttonText':'圖片上傳',
'swf' : '{{asset( 'resources/org/uploadify/uploadify.swf' )}}',//// 引入Uploadify 的核心Flash文件
'uploader' : '{{url( "admin/upload" )}}',//路由地址
'onUploadSuccess' : function(file, data, response) {//回調成功
$( '#art_thumb_v' ).attr( 'src','/'+data).css( {'width':'350px','heigth':'50px'} );
$( 'input[name="art_thumb"]' ).val( data );
}
'onUploadError': function(file, errorCode, errorMsg, errorString) { // 上傳失敗回調函數
$('#picshow').attr('src', '').hide();
$('#file_upload).val('');
alert('上傳失敗,請重試!');
}
});
});
</script>
<style>
.uploadify{
display:inline-block;
}
.uploadify-button{border:none;border-radius:5px;margin-top:8x;}
table.add_tab tr td span.uploadify-button-text{color:#fff;margin:0}
</style>