Re: Passing JAVASCRIPT variable to PHP Script...

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

 



On Tue, 10 Oct 2006 03:09:42 -0700 (PDT), Captain <prabhakaran@xxxxxxxxxxxxxx> wrote:
> 
> 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

This is my ideas:

If the file has already existed, the server-side script could save it in
a place temporarily, and marks the file by an unique identification
(such as md5 checksum). And then the the server-side tells the
client-side file exists and gives it the id. If the user choose
overwrite, the client-side only need to post the received id, do not
need to upload the file again.

--
Sorry for my poor English.

-- 
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