rendered paste bodyin the html file
* note js sets the value of path, and that is seen in the output attached to the basename of the uploaded file, so that's intact.
<form id="fileupload" class="dialog" action="fileupload.php" method="post" enctype="multipart/form-data" target="execframe">
<input type="hidden" name="path" value="" id="uploadpath">
<div class="dialogtitle"><h1 class="dialogtitletext">Upload File</h1><div class="dialogclose" onClick="dialog_close('fileupload');">x</div></div>
<div class="dialogcontent">
<label class="rightalign" for="userfile">File</label><input type="hidden" name="MAX_FILE_SIZE" value="300000" /><input type="file" class="file" name="userfile" id="fileuploadhandler"><br>
</div>
<div class="dialogbuttons"><input type="button" class="button" value="Upload" onclick="dialog_uploading();"> <input type="button" class="button" value="Cancel" onClick="dialog_close('fileupload');"></div>
</form>
and in the script file
<?php
$filenew = $_REQUEST['path'].basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $filenew)) { chmod($filenew, 0664); $success = 1; }
else { $success = 0; }
echo <<<EOT
<script language="javascript" type="text/javascript">
var success = $success;
function closemsg() { parent.dialog_uploaded(); }
function errormsg() { parent.dialog_upload_failed(); }
if (success) { closemsg(); }
else { errormsg(); }
</script>
EOT;
?>