Results 1 to 3 of 3

Thread: What does "Missing boundary in multipart/form-data POST data" warning mean?

  1. #1

    Default What does "Missing boundary in multipart/form-data POST data" warning mean?

    Hi, I'm building an app using Sencha Touch + PHP.


    In Sencha Touch I made this form, to send a title and a pdf file to server:

    Code:
                xtype: 'formpanel',
                id: 'formUp',
                items: [
                    {
                        xtype: 'textfield',
                        id: 'ctTitle',
                        name: 'title',
                        label: 'Title'
                    },
                    {
                        xtype: 'filefield',
                        id: 'ctFile',
                        name: 'filePdf',
                        label: 'File'
                    }    
                ]
    In my Controller there is a function to submit data to php:
    Code:
    onBtnSaveFile: function(){
            Ext.Ajax.request({
                url: 'app-resources/scripts/saveFile.php',
                
                headers: {
                    'Content-Type' : 'multipart/form-data',
                    'Content-type' : 'application/json'
                },
    
                form: 'formUp',
                callback: function(options, success, response) {
                    console.log(response.responseText);
                }
                    
            });
    }
    Now in saveFile.php, I'm using $_FILES to see the size of the uploaded file and save it:
    PHP Code:
    $title $_POST['title'];
    $pdf $_FILES['filePdf']; 
    But when I do submit the console show me this warning:
    Missing boundary in multipart/form-data POST data in <b>Unknown</b> on line <b>0</b><br />
    and these errors:
    Undefined index: title
    Undefined index: filePdf

    Without headers in AJAX request, the code works fine, but the headers is necessary when I need to send a file to php isn't?
    Can someone tell me what does the warning mean? Is there something wrong with my code?
    Thanks!

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    First question I have is why are you using Ext.Ajax to submit a form? Why not use the submit method on the form?
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3

    Default

    What's the difference between using Ext.Ajax and submit method?
    Thanks for response.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •