phantomb
Forum Replies Created
-
Forum: Plugins
In reply to: [Iptanus File Upload] Show Image after UploadThis worked just fine. Much appreciated!
Forum: Plugins
In reply to: [Iptanus File Upload] Changing file paths and using them after upload is done??
Forum: Plugins
In reply to: [Iptanus File Upload] Changing file paths and using them after upload is doneOk! I solved it by doing this:
exec('python /path/to/file.py "' . addslashes($file_path) . '"', $result, $return_var);
Apparently the problem was with shell_exec(). If anyone is having the same problem, use exec() instead!
Also, the result must be printed like this:
foreach ($result as $line) { $changable_data["js_script"] = 'console.log("'.$line.'");'; }
- This reply was modified 6 years, 7 months ago by phantomb.
Forum: Plugins
In reply to: [Iptanus File Upload] Changing file paths and using them after upload is doneHello! Thanks for the response ??
I can execute the code just fine when I set it up like this:
$result = "test";
And I get “test” as my output on the console. But when I’m trying to execute it with my python script, I’m getting the following error:
JQMIGRATE: Migrate is installed, version 1.4.1 VM1476:1 Uncaught SyntaxError: Invalid or unexpected token at wfu_Code_Object.CBUV_Code_Objects.after_upload (wordpress_file_upload_functions.js?ver=4.9.1:96) at wfu_Code_Object.do_action (wordpress_file_upload_functions.js?ver=4.9.1:8) at XMLHttpRequest.xhr.onreadystatechange (wordpress_file_upload_functions.js?ver=4.9.1:82)
I doublechecked the path for the .py code and everything seems to be correct. I’m trying to run with a sample python code first. Here it is:
def helloworld(): myOutput = "helloworld" print (myOutput) return myOutput helloworld()
What could be the problem?
- This reply was modified 6 years, 7 months ago by phantomb.
Forum: Plugins
In reply to: [Iptanus File Upload] Changing file paths and using them after upload is doneJust a small update on the second snippet code:
if (!function_exists('wfu_after_file_loaded_handler')) { function wfu_after_file_loaded_handler($changable_data, $additional_data) { $file_path = $additional_data['file_path']; $result = shell_exec('python /path/to/file.py $file_path'); //$file_path should contain the path for the just uploaded file. //I'm also supposed to echo $result after the upload is done, somehow } add_filter('wfu_after_file_loaded', 'wfu_after_file_loaded_handler', 10, 2); }
I have it in a page.
Hello, thanks for the response!
This is my HTML form:
<form action=”???” method=”post”>
<input checked=”checked” name=”dye” type=”radio” value=”0″ /> Dye 1
<input name=”dye” type=”radio” value=”1″ />Dye 2
</form>I’m not sure what to put in the “action” field.