I'm trying to insert an upload section within a Wordpress post page that gets round the upload file size limit set by the shared hosting.
I put together a form and php script and got the upload bit working. When I went to use it in Wordpress I found that I was unable to use a form within another form.
<script type="text/javascript">
// Javascript to sort out a couple of fields
function triggerSubmit(e){
var textbox1 = document.getElementById('uploadedfileName');
var textbox2 = document.getElementById('firstname');
textbox2.value = textbox1.value;
textbox1.value = '';
return false; // Prevent form auto submittal
}
</script>
<html>
<head></head>
<body>
<form id="myform" enctype="multipart/form-data" action="upload-control.php" method="post" target="foo" onSubmit="window.open('', 'foo', 'width=450,height=300,status=yes,resizable=yes,scrollbars=yes')" method="POST">
Firstname: <input type="text" id="firstname" name="firstname" />
Choose a file to upload: <input name="uploadedfile" type="file" id="uploadedfile" onChange="uploadedfileName.value=uploadedfile.value"/><br /><br>
<input name="uploadedfileName" type="hidden" id="uploadedfileName" tabindex="99" size="1" />
<input type="submit" name="submit" value="Upload File" onClick="triggerSubmit()" />
<br>
</form>
</body>
The form works fine on its own and the php file parses all the data and uploads a file via ftp 
However if I insert this form in to the Wordpress Admin New Post Page, it won't work because it's my form inside their form. I need a work around but my javascript skills are pretty poor.
The php script uses these variables from the form so they need to be passed via javascript...
UPLOAD-CONTROL.PHP
<?
// $output_form = false; // Set output_form variable to false by default.
$fileInfo = $_FILES['uploadedfile']; // Make an array out of the file information. store in $fileInfo
$filePath = $fileInfo['tmp_name']; // Take the file path name and store in $filePath.
$fileName = basename($_FILES['uploadedfile']['name']); // Get filename from path
// Add a check for file name for spaces or dashes - - - <---Those things. Return an error message if spaces/dashes are found.
// Add a check form for valid fields.
//$destination_path = $_SERVER['DOCUMENT_ROOT'].'\\'.$fileName;
$destination_path = "dd/$fileName";
?>
I've been trying to turn the form in to a normal href link but I'm not sure how to pass the variables that the php script requires.
Can anyone help?