This topic is locked
[SOLVED]

 Get Import Filename

6/9/2016 10:08:35 AM
PHPRunner General questions
S
Sitaraman author

Hi all,
I need to save the filename which is imported using the import page. Is there any way I can get the filename in any of the import events? I am using V8.1. Thanks in advance.
Thanks,

Sitaraman S

S
Sitaraman author 6/13/2016

Hi,
Further on the same issue.

This is the code I have tried in the JavascriptOnLoad Event of the Import page

var ctrlFileName=Runner.getControl(pageid, 'file_name');

document.getElementById('hiddenImpotFile1').onchange=function(){

ctrlFileName.setValue(this.value);

};


I get the following error in Firebug
TypeError: ctrlFileName.getValue is not a function
Is the Javascript API is not working as expected in the Import page? Please correct me if I am wrong.
Thanks,

Sitaraman S

Sergey Kornilov admin 6/15/2016

Javascript API works with Edit control only. It won't work on the Import page.
You can use the following code in Import page: BeforeProcess event

if ($_FILES) {

$_SESSION["importFileName"] = $_FILES["importFile1"]["name"];

}



After import you can use $_SESSION["importFileName"] anywhere in your code in any event.

S
Sitaraman author 6/15/2016

Thank you Sergey. It worked like a charm.