|
wb_result_all | PHP Interface | wb_data_transport |
This function allows you to read the file_name data file (sent by an HTML form) into a database (import data into a table). A Data transfer type object must be prepared in the application prior to the actual import. The name of this object is passed in the transfer_object_name parameter. This usually assumes a certain format of the file_name file (e.g. CSV).
Two-way transfers (Database <--> XML files) cannot be executed with this function. A description of these transfers can be found on the XML transfers in the PHP interface page.
TRUE if successful, otherwise FALSE.
HTML code of the form sending (uploading) a file with a suitable table and data transfer object import_test9 in the $appl application):
<form enctype="multipart/form-data" method="POST" action="upload_file.php" > Choose the file: <input type="FILE" name="upl_file"> <br> The file must be in the CSV format structure specified by the documentation!<br><br> <input type="SUBMIT" value="Send"> </form>
Excerpt of the script upload_file.php:
echo "<h1>upload_file: ".$_FILES["upl_file"]['name']."</h1>"; echo "<br>type: ".$_FILES["upl_file"]['type']; echo "<br>size: ".$_FILES["upl_file"]['size']; $conn=wb_connect($dsn, $appl, $dbuser); if ($conn){ $result = wb_import_file($conn, $_POST["upl_file"], "import_test9"); if ($result) {echo "<br><br>Data imported!";} else {echo "<br><br>Import failed!";} }
wb_result_all | PHP Interface | wb_data_transport |