2017-04-07 2 views
1

내 서버에서 파일을 업로드하기 위해 blueimp의 잘 알려진 jquery 파일 업로드 플러그인을 사용하고 있습니다. 오류 메시지를 제 언어로 변경하고 싶지만 붙어 있습니다.Jquery 파일 업로드 blueimp에서 오류 메시지 텍스트를 변경할 수 없습니다.

여기에 내 내장 UploadHandler.php 파일의 오류 메시지 섹션이 있습니다. 서버/PHP/UploadHandler.php에있는 제한 사항의 전체 파일을 공유 할 수 없어 관련 섹션을 복사합니다. 오류 텍스트를 제 언어로 변경했지만 영향을받지 않습니다. stackoverflow에서이 플러그인에 관한 거의 모든 기사를 읽었으며 만족스러운 해결책을 찾지 못했습니다. 도움을 기다리고 있습니다, 미리 감사드립니다. 여기

class UploadHandler 
{ 

    protected $options; 

    // PHP File Upload error message codes: 
    // http://php.net/manual/en/features.file-upload.errors.php 
    protected $error_messages = array(
     1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', 
     2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 
     3 => 'The uploaded file was only partially uploaded', 
     4 => 'No file was uploaded', 
     6 => 'Missing a temporary folder', 
     7 => 'Failed to write file to disk', 
     8 => 'A PHP extension stopped the file upload', 
     'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini', 
     'max_file_size' => 'File is too big', 
     'min_file_size' => 'File is too small', 
     'accept_file_types' => 'Filetype not allowed', 
     'max_number_of_files' => 'Maximum number of files exceeded', 
     'max_width' => 'Image exceeds maximum width', 
     'min_width' => 'Image requires a minimum width', 
     'max_height' => 'Image exceeds maximum height', 
     'min_height' => 'Image requires a minimum height', 
     'abort' => 'File upload aborted', 
     'image_resize' => 'Failed to resize image' 
    ); 

. 
. 
. 
. 
. 
. 
. 

은 내 main.js 파일의 js/main.js 나는이 사람을 도울 수 있기를 바랍니다

$(function() { 
    'use strict'; 

    // Initialize the jQuery File Upload widget: 
    $('#fileupload').fileupload({ 
     // Uncomment the following to send cross-domain cookies: 
     //xhrFields: {withCredentials: true}, 
     url: 'server/php/' 
    }); 

    // Enable iframe cross-domain access via redirect option: 
    $('#fileupload').fileupload(
     'option', 
     'redirect', 
     window.location.href.replace(
      /\/[^\/]*$/, 
      '/cors/result.html?%s' 
     ) 
    ); 

    if (window.location.hostname === 'blueimp.github.io') { 
     // Demo settings: 
     $('#fileupload').fileupload('option', { 
      url: '//jquery-file-upload.appspot.com/', 
      // Enable image resizing, except for Android and Opera, 
      // which actually support image resizing, but fail to 
      // send Blob objects via XHR requests: 
      disableImageResize: /Android(?!.*Chrome)|Opera/ 
       .test(window.navigator.userAgent), 
      maxFileSize: 999000, 
      acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i 
     }); 
     // Upload server status check for browsers with CORS support: 
     if ($.support.cors) { 
      $.ajax({ 
       url: '//jquery-file-upload.appspot.com/', 
       type: 'HEAD' 
      }).fail(function() { 
       $('<div class="alert alert-danger"/>') 
        .text('Upload server currently unavailable - ' + 
          new Date()) 
        .appendTo('#fileupload'); 
      }); 
     } 
    } else { 
     // Load existing files: 
     $('#fileupload').addClass('fileupload-processing'); 
     $.ajax({ 
      // Uncomment the following to send cross-domain cookies: 
      //xhrFields: {withCredentials: true}, 
      url: $('#fileupload').fileupload('option', 'url'), 
      dataType: 'json', 
      context: $('#fileupload')[0] 
     }).always(function() { 
      $(this).removeClass('fileupload-processing'); 
     }).done(function (result) { 
      $(this).fileupload('option', 'done') 
       .call(this, $.Event('done'), {result: result}); 
     }); 
    } 

}); 

답변

0

에 있습니다. (라인 71 정도) : "// 오류 및 정보 메시지"

는 대한 jquery_upload/JS

검색 내부의 jquery.fileupload-validade.js를 찾아보십시오.

메시지를 수동으로 변경하십시오.

관련 문제