Unable to retrieve json output from python to php -
I am trying to create a webpage that takes me into the file and sends the file to the Python program, manilizes it And sends back results on php and then displayed back on the webpage
For now, I am displaying the code as a webpage which takes a file into it, sends it into the python, the file's Name, sends it back to php and prints it in the webpage. I have not been able to get the result back to my webpage or my php page via python for phonphs to json.
Here are the codes:
test.html
& lt; Form action = "test.php" method = "post" enctype = "multipurpose / farm-data" & gt; & Lt; Label = "file" & gt; Filename: & lt; / Label & gt; & Lt; Input type = "file" name = "file" id = "file" & gt; & Lt; Br> & Lt; Input type = "submit" name = "submit" value = "submit" & gt; & Lt; / Form & gt;
test.php
& lt ?? Php if ($ _FILES ["file"] ["error"]> gt; {echo "error:". $ _FILES ["file"] ["error"]. ""
";} and {$ Filepath = $ _ files ["file"] ["tmp_name"]; $ MyFile = $ filepath; $ Result = shell_exec ('C: \\ Python33 \\ python C: \\ xampp \\ htdocs \\ pathovcf \ \ Test.py 'escapeshellarg (json_encode ($ myFile)); $ result data = json_decode ($ result, true); counterpoint $ resultData;}?
import import import system import json import re-file path = json.loads (sys.argv [1]) print (json.dumps < / P>
Comments
Post a Comment