Access uploaded file in JSON encoded data
- by okello
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.