2014-10-24 13 views
0

파일 크기를 가져와 비활성화 된 텍스트 상자에 표시하고 싶습니다.Uploadify 파일 크기 확인 및 텍스트 상자에 표시

나는 인터넷 검색을하고 이것에 대한 정보는 매우 적습니다.

<div class="inputWrapper"> 
     <div class="usetitle">* <?php echo Yii::t('labels', 'gameapk'); ?> : 
      <div class="div_upload_file_container"> 
       <div style="position:absolute; margin: 0; padding:0; height:27px">    
        <input style="display:none" id="btnUploadFile" name="btnUploadFile" type="file" />        
       </div>  
       <div class="div_upload_file_container_inner">          
        <div class='word'> 

        </div>       
        <div style='clear:both'></div> 
       </div> 
      </div> 
      <div style="height:50px"></div> 
      <div id="uploaded_file"></div> 
     </div> 
     <div class="error2"><div id="err_btnUploadFile"></div></div> 
    </div> 

JS 파일 : 다음 울부 짖는 소리 내 코드 PHP에서

입니다

//file 
     $('#btnUploadFile').uploadify({ 
     'swf': base_url + '/js/plugins/uploadify321/uploadify.swf', 
     'uploader': "index.php?r=apk/uploadfile", 
     'folder' : '/temp', 
     'queueID': 'uploaded_file', 
     'queueSizeLimit' : 1, 
     'progressData': 'speed', 
     'removeCompleted': false, 
     'width': $('.div_upload_file_container').width(), 
     'height': 28, 
     'fileTypeDesc': 'Apk Files (*.apk)', 
     'fileTypeExts': '*.apk;', 
     'fileSizeLimit': '100GB', 
     'uploadLimit' : 1, 
     'itemTemplate': uploadedFileItem(), 
     'buttonText' : UPLOAD_FILE, 
     'onSelect': function (file) { 

     }, 
     'onUploadStart': function (file) { 


     }, 
     'onUploadSuccess': function (file, data, response) { 

      console.log (data); 
      $('#' + file.id).html(file.name); 

      var obj = JSON.parse(data); 
      statusCode = obj.statusCode; 

      if (statusCode == '200'){ 
       console.log (data); 
       var today = obj.today; 
       var tmp_folder_with_date = obj.tmp_folder_with_date; 
       var filesize = obj.filesize; 
       var hashfilename_filename = obj.hashfilename_filename; 
       var full_path = obj.full_path;    

       file_cnt ++; 

       var html = ''; 
       html = '<div>'; 
       html += '<div style="float:left">'; 
       html += file_cnt + '.'; 
       html += '</div>'; 
       html += '<div style="float:left; margin: 0 0 0 10px">'; 
       html += file.name; 
       html += '</div>'; 
       html += '<div style="clear:both"></div>'; 
       html += '</div>'; 

       $('#' + file.id).html(html); 

      } 

      var params = { 
       fileid: file.id, 
       fileName: obj.fileName, 
       fullSavePath_original: obj.fullSavePath_original, 
       fullSavePath_resize: obj.fullSavePath_resize, 
       fullSavePath_tobesave: obj.fullSavePath_tobesave, 
       fullSavePath_tobesaveURL: obj.fullSavePath_tobesaveURL, 
       filesize: obj.fileSize, 
       fullPath_TempFolder: obj.fullPath_TempFolder, 
       orientation: obj.orientation, 
       tobesave_file_width: obj.tobesave_file_width, 
       tobesave_file_height: obj.tobesave_file_height, 
       todayTempFolder: obj.todayTempFolder 
      }; 

      DisplayNewUploadedPhotos(params); 

     }, 
     'onUploadComplete': function (file) { 

     }, 
     'onCancel': function (event,ID,fileObj,data) { 

     }, 
     'onDialogClose': function (queueData) { 

     }, 
     'onInit': function (instance) { 

     }, 
     'onQueueComplete': function (queueData) { 

     }, 
     'onClearQueue': function (queueItemCount) { 

     } 
    }); 

    function uploadedFileItem() { 

     var html = '';  

     html = '<div id="${fileID}" class="fileUploadedItem">';  
     html += '<div style="margin:10px 0 0 0"></div>'; 
     html += '<div class="uploadify-progress-bar"></div>'; 
     html += '<div style="margin:10px 0 0 0">'; 
     html += '<center><a href="#">Cancel</a></center>'; 
     html += '</div>'; 
     html += '</div>'; 

     return html; 
    } 

obj.filesize 파일 크기는 ... 내가 해결하고 있습니까? 내가 맞다면, JS에서 내 텍스트 박스로 obj.filesize을 얻으려면 어떻게해야합니까?

답변

0

갑자기 그렇게 할 생각이 :

$("#appsize").attr('value', obj.filesize); 

하하 감사합니다 = D