Project

General

Profile

File "POST"

Added by Vaclav Trhlik almost 5 years ago

Hi, I need to post selected file to my code. In Extplorer I select line with TXT file name and then I need to post it to another code to generate PDF file. Any ideas, how can I do it?

I try to make javascript like:

requestParams = getRequestParams();
Ext.urlEncode( requestParams );
if (requestParams.item.length>0){
// pFileName = dirTree.getSelectionModel().getSelectedNode().id.replace( /_RRR_/g, '/' ) + '/' + pRow[0].get('name');
// pFileName = pRow[0].get('name');
pFormToPDF = document.createElement('form');
pFormToPDF.action = '<?php echo _EXT_URL . "/csvtopdf.php?lang=" . $GLOBALS["language"] ?>' + '&' + Ext.urlEncode( requestParams );
pFormToPDF.method = 'post';
pFormToPDF.enctype = 'multipart/form-data';
pFileInput= document.createElement('input');
pFileInput.type = 'file';
pFileInput.name = 'csvfile';
pFileInput.value = dirTree.getSelectionModel().getSelectedNode().id.replace( /_RRR_/g, '/' ) + '/' + requestParams.item[0];
pFormToPDF.appendChild(pFileInput);
document.getElementById('convertForm').appendChild(pFormToPDF);
pFormToPDF.submit();
}

but with SecurityError: The operation is insecure. at "pFileInput.value = dirTree.getSelectionModel().getSelectedNode().id.replace( /_RRR_/g, '/' ) + '/' + requestParams.item0;" line.

Thanks for any ideas.

Netrva