Passing JAVASCRIPT variable to PHP Script...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi geeks,
          i am uploading a file to server. Uploading part is working fine. i
am struggle with minor part. actually before uploading file, i am checking
for existance of a file. If it is not exists, directly i am uploading that
file. If it exists, i sud ask user that "This file is exits. Do You really
want to Upload it?"...If YES, i will overwrite it. otherwise, i won't do
anything.
         i am using javascript for popup windows. i used confirm()
function(CANCEL / OK).
         the problem is, i am not able to get the variable value for php
script. Of course, php is server side programming language & javascript
client side programming language.
Plz see my code & give the solution.

See my progress:

                                 "upload.php"

# Checking for the File existance
if (file_exists($fullPath)) {
                       echo "<script language='JavaScript'>if(confirm('This
file is already Exists ! Do You Want to Duplicate ?')) { var s=1;} else {var
s=0;} </script>";

                       $decide="<script
language='JavaScript'>document.write(s)</script>";
                       echo "$decide";
                       if (!$decide) {
                                      // Don't Upload
                                        exit;
                       }
                       else {
                                       // Upload the file
                       }

In this code, echo "$decide"; is printing whether 1 or 0. But by using that
variable, i cudn't proceed further. Bcoz it is not useful for manipulating.

* Is anyway to store that variable value in a static file, so that, i can
proceed easily.
* Is it possible to execute shell commands by javascript, so that i can
create file & store this variable.

If it is not possible, plz give any other solution.
Expecting ur reply.

Thanks in advance
Prabhakaran.
-- 
View this message in context: http://www.nabble.com/Passing-JAVASCRIPT-variable-to-PHP-Script...-tf2415628.html#a6733549
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux