This topic is locked

Retrieve File Name from File Uploaded Column

3/6/2021 3:51:04 AM
PHPRunner General questions
A
Abhijeet author

Hello Team,
Greetings !
I am using phprunner 10.5 build 36520 on windows 10 and wamp server having mysql 8 CE on backend.
I have a query when I upload a file, phprunner adds some 8 character random text with a underscore preceding and containing the extension of the filename with some other details. I don't have any query with the file name, but I have a different php program which needs to retrieve just the file name from this column for further processing.
Can you please give me a hint as to how to retrieve just the file name by using plain php program from below string by using any php function ?
[{"name":"files\/test document_87176dkn.txt","usrName":"test document.txt","size":0,"type":"text\/plain","searchStr":"test document.txt,!:sStrEnd"}]
Please try to give me a purely php solution to retrieve filename given in bold, as I am not much conversant with java.
Your expert help will just make my day !
Thanks in advance.

S
Steve Seymour 3/6/2021



Hello Team,
Greetings !
I am using phprunner 10.5 build 36520 on windows 10 and wamp server having mysql 8 CE on backend.
I have a query when I upload a file, phprunner adds some 8 character random text with a underscore preceding and containing the extension of the filename with some other details. I don't have any query with the file name, but I have a different php program which needs to retrieve just the file name from this column for further processing.
Can you please give me a hint as to how to retrieve just the file name by using plain php program from below string by using any php function ?
[{"name":"files\/test document_87176dkn.txt","usrName":"test document.txt","size":0,"type":"text\/plain","searchStr":"test document.txt,!:sStrEnd"}]
Please try to give me a purely php solution to retrieve filename given in bold, as I am not much conversant with java.
Your expert help will just make my day !
Thanks in advance.


I have an application where I need to get the filename in the before record update event

I do it like this...
$fileArray = my_json_decode($values["url"]);

$_SESSION['pdfname'] = $fileArray[0]["name"];
url is the name of the field name the file is stored in my table.

I'm storing the filename (in my case a pdf file) in a $_SESSION variable for access by other routines.
The field "url" contains this json as an example: [{"name":"files\/Creator\/phil_stone_n4xaigeh.pdf","usrName":"phil_stone.pdf","size":976205,"type":"application\/pdf","searchStr":"phil_stone.pdf,!:sStrEnd"}]
You can get the uploaded filename including the path, or by looking at useName - you could get the original filename.
Hope that helps.

Steve.