balex balex - 2 years ago 115
Ajax Question

Ajax Post with Filename as Parameter

I know how to do an Ajax Post to a PHP File wich writes/creates a File on the Server. But is it possible to send a Parameter wich tells the PHP how the file wich should be created is named?

Thank you in advance!

Answer Source

In your Javascript code add data to pass to php script:

    method: 'POST',
    url: '/your_php_script.php',
    data: {
      filename: 'some_name'

In your PHP script:

$filename = $_POST['filename'];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download