Using Javascript alert in the middle of PHP code

Alternative 1:
The good thing about alternative 1 is that you can use the actual php variables directly in Javascript code
[code lang="php"]
<?php
$counter = 123;
//PHP Code
print '<script type="text/javascript">'; //Php writing javascript code ...
print 'alert("' . $counter . ' files were coppied")'; //Php writing javascript code ...
print '</script>'; //Php writing javascript code ...
//PHP Code Continues
?>
[/code]

Alternative 2:
[code lang="php"]
<?php
$counter = 0;
// php code
if( $counter = 0 ) )
{
?>
<script >
alert('Problem occured during uploading ...')
</script>
<?php
}
//Some more php code
?>
[/code]

Fakepath issue, actually is not an issue

Some browsers have a security feature which prevents HTML/javascript/PHP from knowing your file’s local full path. This is necessarily not bad for a developer as you still could upload the files. Looking at it as a client, you wouldn’t want the server to know about your local machine’s file system.

If you really want to see the path, you could simply go to Internet Explorer, Tools, Internet Option, Security, Custom, find the “Include local directory path When uploading files to a server” (it is quite a ways down) and click on “Enable” .