I am adding an upload function to the HTML div, but for some reason it is not working. I have also created a php file with the same scripts I have added to the div and did the action="upload-page.php", but it does not get the php page either. What could be the problem? Here is the code:
<div class="wall-ptype-cnt wall_text" >
__post_wall_text__
<form method="post" action="upload-page.php" enctype="multipart/form-data">
<input name="filesToUpload[]" id="filesToUpload" type="file" multiple="" />
<script language="javascript" type="text/javascript">
var input = document.getElementById('filesToUpload');
var list = document.getElementById('fileList');
while (list.hasChildNodes()) {
list.removeChild(ul.firstChild);
}
for (var x = 0; x < input.files.length; x++) {
var li = document.createElement('li');
li.innerHTML = 'File ' + (x + 1) + ': ' + input.files[x].name;
list.append(li);
}
</script>
<?php if(count($_FILES['uploads']['filesToUpload'])) {
foreach ($_FILES['uploads']['filesToUpload'] as $file) {
//do your upload stuff here
echo $file;
}
}
?>
</form>
</div>
Why does the php page is not being processed and why the script is not working as well? The script I have in upload-page.php is the same I am putting inside html.
window.onload = function() {//do your upload stuff here. There is nothing showing where your files are uploaded to, unless you're not showing us your entire code. Consult the PHP manual: php.net/manual/en/features.file-upload.php