...

View Full Version : trying to open php file from javascript



johnboy0072006
09-06-2011, 10:04 AM
Hi guys i have an embedded game in an html (unity3D) and i am wanting to delete a file from my server.

so at the moment i have a php file on my server and the html containing the javascript on my desktop.

test.php

<?php
$conn = ftp_connect("ftp.domain.co.uk") or die("Could not connect");
ftp_login($conn,"username","password");

echo ftp_delete($conn,"test.txt");

ftp_close($conn);
?>

I will out the correct domian name and username and password and this should delete a file named test.txt on my server.

the problem i am having is calling this script from my javascript which is my main html:
i have searched all over and found if i do this :

<script language="JavaScript">
function DELETE_SERVER_FILE()
{
dummyimage = new Image();
dummyimage.src ="http://www.domain.co.uk/test.php"
}

</script>


But this is not working, can anyone help?

Kor
09-06-2011, 01:47 PM
use AJAX:
http://en.wikipedia.org/wiki/Ajax_%28programming%29



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum