Hey everyone,
I wrote a file upload, very simple one, but somehow its not working… I think the problem is that the file is not getting received by the PHP script.
Here’s the form:
<form enctype="multipart/form-data" id = "documentupld" action = "documentadd.php" method = "POST">
<input type="hidden" name="MAX_FILE_SIZE" value="128000000" />
<p>
<label for = "file">Select file for upload</label>
<input name = "document" type = "file" >
</p>
<p>
<label for = "submit"></label>
<input type = "submit" name = "submit" value = "Submit!"/>
</p>
</form>
Here’s the PHP script:
[php]
<?php $target_path = "../docs/"; $target_parth = $target_path.basename($_FILES['document']['name']); print $target_path.""; if(move_uploaded_file($_FILES['document']['tmp_name'], $target_path)) { echo "The file ".basename( $_FILES['document']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?>
[/php]
When the $target_path gets printed, it just comes as “…/docs/”, and not the file name.
Thanks for your help
Ramanakumar