Hi
I now have created the following report (?):
DROP PROCEDURE IF EXISTS sp_DBR_Test_Import
$$
CREATE PROCEDURE sp_DBR_Test_Import
()
BEGIN
select 'dbr.html','<form action="user/upload.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload AllProperties File" name="submit">
</form>
';
END
$$
The php file is a rather basic uploader that I'll develop further.
<?php
$target_dir = "../user/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$FileType = pathinfo($target_file,PATHINFO_EXTENSION);
$FileName = pathinfo($target_file,PATHINFO_BASENAME);
// Check if file already exists
/*if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}*/
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if($FileName != "AllProperties.csv" ) {
echo "Sorry, only AllProperties.csv is allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (copy($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
?>
This works fine in that I can select the file and it uploads as required.
I'm now stuck at how to incorporate the above.
I would like to call the SP that then processes the uploaded file.
I've tried to call the SP that does the processing from the upload.php file but I can't get it to work.
If I add the upload form section into the processing SP the SP doesn't wait until the file gets uploaded.
Any pointers on how I can use the above?
Cheers
Jake