2012-09-09 60 views
1

我正在使用此uploadify插件。我發佈變量,但一切工作正常,但是當我上傳文件大小超過5MB它不會發布數據。這裏是我的代碼和調試信息。我試圖改變甚至設置爲0,這意味着沒有限制.changed在php.ini的上傳限制設置大小限制,但它仍然不會工作使用uploadify發送formData不適用於較大的文件大小

   //Upload Song#2 




$('#upload_song2').uploadify({ 
    'auto'   : true, 
    'multi'   : false, 
    'fileTypeDesc' : 'Mp3 Files', 
    'fileTypeExts' : '*.mp3', 
    'swf'   : 'uploadify.swf', 
    'uploader'  : 'artist_music_process.php' , 
     'sizeLimit': 25600, // 25 MB 


    'onUploadStart' : function(file) 
{ 
    console.log(file); 
    $('#upload_song2').uploadify("settings", 
     "formData", { 
     "column":'album_song_name2', 
     'artist_id' : '<?php echo $artist_details['id']; ?>', 
     'username' : '<?php echo $artist_details['username'];?>' 


     }); 
    }, 










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


     { 
      alert(data); 
     $("#container").notify("create", { 
     title: 'Success', 
     text: file.name+' Uploaded with success' 
     });  

     $('#txt_song2').val(file.name); 
     $('#hid_song2').val(data); 





     } 
     // Your options here 

    }); //uploadify ends 

這是我的調試代碼。

           ---SWFUpload Instance Info--- 
       Version: 2.2.0 2009-03-25 
       Movie Name: SWFUpload_0 
       Settings: 
        upload_url:    /desi/artist_music_process.php 
        flash_url:    uploadify.swf?preventswfcaching=1347196919191 
        use_query_string:   false 
        requeue_on_error:   false 
        http_success:    
        assume_success_timeout: 30 
        file_post_name:   Filedata 
        post_params:    [object Object] 
        file_types:    *.mp3 
        file_types_description: Mp3 Files 
        file_size_limit:   0 
        file_upload_limit:  0 
        file_queue_limit:   999 
        debug:     true 
        prevent_swf_caching:  true 
        button_placeholder_id: upload_song2 
        button_placeholder:  Not Set 
        button_image_url:   /desi/ 
        button_width:    120 
        button_height:   30 
        button_text:    
        button_text_style:  color: #000000; font-size: 16pt; 
        button_text_top_padding: 0 
        button_text_left_padding: 0 
        button_action:   -100 
        button_disabled:   false 
        custom_settings:   [object Object] 
       Event Handlers: 
        swfupload_loaded_handler assigned: false 
        file_dialog_start_handler assigned: true 
        file_queued_handler assigned:  true 
        file_queue_error_handler assigned: true 
        upload_start_handler assigned:  true 
        upload_progress_handler assigned: true 
        upload_error_handler assigned:  true 
        upload_success_handler assigned: true 
        upload_complete_handler assigned: true 
        debug_handler assigned:    true 

       ---SWFUpload Instance Info--- 
       Version: 2.2.0 2009-03-25 
       Movie Name: SWFUpload_1 
       Settings: 
        upload_url:    /desi/artist_music_process.php 
        flash_url:    uploadify.swf?preventswfcaching=1347196919200 
        use_query_string:   false 
        requeue_on_error:   false 
        http_success:    
        assume_success_timeout: 30 
        file_post_name:   Filedata 
        post_params:    [object Object] 
        file_types:    *.mp3 
        file_types_description: Mp3 Files 
        file_size_limit:   0 
        file_upload_limit:  0 
        file_queue_limit:   999 
        debug:     true 
        prevent_swf_caching:  true 
        button_placeholder_id: upload_song 
        button_placeholder:  Not Set 
        button_image_url:   /desi/ 
        button_width:    120 
        button_height:   30 
        button_text:    
        button_text_style:  color: #000000; font-size: 16pt; 
        button_text_top_padding: 0 
        button_text_left_padding: 0 
        button_action:   -100 
        button_disabled:   false 
        custom_settings:   [object Object] 
       Event Handlers: 
        swfupload_loaded_handler assigned: false 
        file_dialog_start_handler assigned: true 
        file_queued_handler assigned:  true 
        file_queue_error_handler assigned: true 
        upload_start_handler assigned:  true 
        upload_progress_handler assigned: true 
        upload_error_handler assigned:  true 
        upload_success_handler assigned: true 
        upload_complete_handler assigned: true 
        debug_handler assigned:    true 

       ---SWFUpload Instance Info--- 
       Version: 2.2.0 2009-03-25 
       Movie Name: SWFUpload_2 
       Settings: 
        upload_url:    /desi/artist_music_process.php 
        flash_url:    uploadify.swf?preventswfcaching=1347196919207 
        use_query_string:   false 
        requeue_on_error:   false 
        http_success:    
        assume_success_timeout: 30 
        file_post_name:   Filedata 
        post_params:    [object Object] 
        file_types:    *.jpg; *.png 
        file_types_description: Image Files 
        file_size_limit:   0 
        file_upload_limit:  0 
        file_queue_limit:   999 
        debug:     true 
        prevent_swf_caching:  true 
        button_placeholder_id: upload_album_img 
        button_placeholder:  Not Set 
        button_image_url:   /desi/ 
        button_width:    120 
        button_height:   30 
        button_text:    
        button_text_style:  color: #000000; font-size: 16pt; 
        button_text_top_padding: 0 
        button_text_left_padding: 0 
        button_action:   -100 
        button_disabled:   false 
        custom_settings:   [object Object] 
       Event Handlers: 
        swfupload_loaded_handler assigned: false 
        file_dialog_start_handler assigned: true 
        file_queued_handler assigned:  true 
        file_queue_error_handler assigned: true 
        upload_start_handler assigned:  true 
        upload_progress_handler assigned: true 
        upload_error_handler assigned:  true 
        upload_success_handler assigned: true 
        upload_complete_handler assigned: true 
        debug_handler assigned:    true 

       SWF DEBUG: SWFUpload Init Complete 
       SWF DEBUG: 
       SWF DEBUG: ----- SWF DEBUG OUTPUT ---- 
       SWF DEBUG: Build Number:   SWFUPLOAD 2.2.0 
       SWF DEBUG: movieName:    SWFUpload_0 
       SWF DEBUG: Upload URL:    /desi/artist_music_process.php 
       SWF DEBUG: File Types String:  *.mp3 
       SWF DEBUG: Parsed File Types:  mp3 
       SWF DEBUG: HTTP Success:   0 
       SWF DEBUG: File Types Description: Mp3 Files (*.mp3) 
       SWF DEBUG: File Size Limit:  0 bytes 
       SWF DEBUG: File Upload Limit:  0 
       SWF DEBUG: File Queue Limit:  999 
       SWF DEBUG: Post Params: 
       SWF DEBUG: ----- END SWF DEBUG OUTPUT ---- 
       SWF DEBUG: 
       SWF DEBUG: Event: fileDialogStart : Browsing files. Single Select. Allowed file types: *.mp3 
       SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list... 
       SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0 
       SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1 
       SWF DEBUG: StartUpload: First file in queue 
       SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0 
       SWF DEBUG: Global Post Item: username=basit 
       SWF DEBUG: Global Post Item: column=album_song_name2 
       SWF DEBUG: Global Post Item: artist_id=7 
       SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to /desi/artist_music_process.php for File ID: SWFUpload_0_0 
       SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0 
       SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 4128768. Total: 10070528 
       SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 10070528. Total: 10070528 
       SWF DEBUG: Event: uploadSuccess: File ID: SWFUpload_0_0 Response Received: true Data: Array 
       SWF DEBUG: (
       SWF DEBUG:) 
       SWF DEBUG: Array 
       SWF DEBUG: (
       SWF DEBUG:) 
       SWF DEBUG: 
       SWF DEBUG: Event: uploadComplete : Upload cycle complete. 
       SWF DEBUG: Event: fileDialogStart : Browsing files. Single Select. Allowed file types: *.mp3 
       SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list... 
       SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_1 
       SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1 
       SWF DEBUG: StartUpload: First file in queue 
       SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_1 
       SWF DEBUG: Global Post Item: username=basit 
       SWF DEBUG: Global Post Item: column=album_song_name2 
       SWF DEBUG: Global Post Item: artist_id=7 
       SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to /desi/artist_music_process.php for File ID: SWFUpload_0_1 
       SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_1 
       SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_1. Bytes: 5599328. Total: 5599328 
       SWF DEBUG: Event: uploadSuccess: File ID: SWFUpload_0_1 Response Received: true Data: Array 
       SWF DEBUG: (
       SWF DEBUG:  [Filename] => Utay - Copy.mp3 
       SWF DEBUG:  [username] => basit 
       SWF DEBUG:  [column] => album_song_name2 
       SWF DEBUG:  [artist_id] => 7 
       SWF DEBUG:  [Upload] => Submit Query 
       SWF DEBUG:) 
       SWF DEBUG: Array 
       SWF DEBUG: (
       SWF DEBUG:  [Filedata] => Array 
       SWF DEBUG:   (
       SWF DEBUG:    [name] => Utay - Copy.mp3 
       SWF DEBUG:    [type] => application/octet-stream 
       SWF DEBUG:    [tmp_name] => C:\wamp\tmp\phpAB62.tmp 
       SWF DEBUG:    [error] => 0 
       SWF DEBUG:    [size] => 5599328 
       SWF DEBUG:  ) 
       SWF DEBUG: 
       SWF DEBUG:) 
       SWF DEBUG: basit_utay - copy.mp3 
       SWF DEBUG: Event: uploadComplete : Upload cycle complete. 
+0

你在phpinfo()中驗證了嗎?您能夠成功更改後限制? – rationalboss

+0

是的,我做到了。它的25 mb –

回答

4

嘗試更新您的php.ini以上傳大文件。你需要改變以下變量

file_uploadsile_uploads 
    upload_max_filesize 
    max_input_time 
    memory_limit 
    max_execution_time 
    post_max_size 
+0

我正在本地主機上運行...所以執行時間無關緊要,我怎麼讓它們改變..我嘗試了7 MB的工作正常,但之後它不是 –

+0

更改所有變量,然後您可以上傳大文件 – shail

+0

icant在我的php.ini中找到這些變量只有第一個是 upload_max_filesize –

0

我和你有同樣的問題。我的php ini文件信譽良好。我意識到我的jpeg圖像擴展名是大寫字母(.JPG),而且我僅在我的上傳php腳本中檢查文件類型,只是小寫擴展名。我修改它以反映大寫和小寫,這解決了我的問題,上傳大於2MB的文件!

希望這可以幫助別人!

$fileTypes = array('jpg','jpeg','gif','png','JPG','GIF','JPEG','PNG'); // File extensions 
$fileParts = pathinfo($_FILES['Filedata']['name']); 

if (in_array($fileParts['extension'],$fileTypes)) {