Access uploaded file in JSON encoded data

Posted by okello on Stack Overflow See other posts from Stack Overflow or by okello
Published on 2012-12-16T04:58:55Z Indexed on 2012/12/16 5:03 UTC
Read the original article Hit count: 162

Filed under:
|

I've encoded my form data into JSON. This has been achieved by the following ExtJS store configuration:

Ext.define('XXX.store.Registration', {
    extend: 'Ext.data.Store',
    model: 'XXX.model.Registration',
    autoLoad: true,
    pageSize: 15,
    autoLoad: {
        start: 0,
        limit: 15
    },

    proxy: {
        type: 'ajax',
        api: {
            create: './server/registration/create.php',
            read: './server/registration/get.php',
            update: './server/registration/update.php',
            destroy: './server/registration/destroy.php'
        },
        reader: {
            type: 'json',
            root: 'registrations',
            successProperty: 'success'
        },
        writer: {
            type: 'json',
            writeAllFields: true,
            encode: true,
            root: 'registrations'
        }
    }

});

My server side code has been implemented in PHP. I can access the encoded form fields by using the field name as a key, as exemplified below:

$reg  = $_REQUEST['registrations'];

$data = json_decode(stripslashes($reg));

$registerNum = $data->registerNum;
$folioNum = $data->folioNum;

One of the fields in my form is a fileuploadfield. How can I access the uploaded file from the uploaded JSON. Any assistance will be highly appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about extjs4