javascript - Php code instead of data in Ajax -


i have ajax code, pretty simple :

$.ajax({          type: "post",          url: "save.php",          data: {          imgbase64: dataurl,          counter : time          }        }); 

and in other side, have php file :

<?php define('upload_dir', 'upload/'); $img = $_post['imgbase64']; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $counter = $_post['counter']; $formatedcounter = sprintf('%03d', $counter); $data = base64_decode($img); $filename = upload_dir . 'gwd' .  $formatedcounter . '.png'; $success = file_put_contents($filename, $data); print $success ? $file : 'unable save file.'; ?> 

i combine both. possible write php code instead of "save.php" data in ajax? i've tried errors in phpstorm.

thanks lot! regards.

thanks lot guys.

so can point file. it's not (for example) possible write php code after , point it.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -