echo '<p>Sorry, but there were problems encountered that prevented the file from being uploaded:'; echo '<ul>'; foreach ($errors as $error) { echo '<li>' . $error . '</li>'; } echo '</ul>'; echo '<a href="container-upload-form.php">Click here</a> to try again.'; echo '</p>'; } else { // Create a record in the Resources table. $fm_request = $fmDemo->newAddCommand('Resource - Form'); $fm_request->setField('Title', 'Demo Upload'); $fm_request->setField('File_Name', $_FILES['uploaded_file']['name']); $fm_request->setField('File_Type', $_FILES['uploaded_file']['type']); $fm_request->setField('File_Size', $_FILES['uploaded_file']['size']); $fm_request->setField('Uploader_IP_Address', fmGetRemoteAddress()); $fm_result = $fm_request->execute(); if (FileMaker::isError($fm_result)) { echo '<h2>An Unexpected Error Has Occurred</h2>'; echo "Error Code: " . $fm_result->code . "<br>"; echo "Error Message: " . $fm_result->getMessage() . "<br>"; } else { // Get the record that was just created. $resource_records = $fm_result->getRecords(); $resource_record = $resource_records[0]; // Upload the file into the new record's container field. $resource_record_updated = fmPutContainer($fmDemo, 'Resource - Form', 'Resource', $resource_record, $_FILES['uploaded_file']); // fmDump ( $resource_record_updated, TRUE, 'resource_record_updated') ; // Get an FMWebFrame URL for the uploaded file. $uploaded_file_url = fmGetContainerURL($fmDemo, $resource_record_updated, 'Resource', TRUE, NULL, 60 * 5, NULL); echo '<p style="font-weight: bold;">The file was uploaded successfully.</p>';
// Set page title. $ui_title = "FMWebFrame Demo | Additional Functions"; // Start output buffering. ob_start(); echo '<h1>Additional Functions</h1>'; echo '<p>'; echo 'FMWebFrame includes a few additional functions that we have found to be helpful, '; echo 'including functions to validate email addresses, get Web server and request information, and more.'; echo '</p>'; echo '<p>'; echo 'Examples of calls to those functions follow...'; echo '</p>'; echo '<p>• fmGetDocumentRoot () = ' . fmGetDocumentRoot() . '</p>'; echo '<p>• fmError ( 202 ) = ' . fmError(202) . '</p>'; echo '<p>• fmGetDocumentRoot() = ' . fmGetDocumentRoot() . '</p>'; echo '<p>• fmGetRemoteAddress() = ' . fmGetRemoteAddress() . '</p>'; echo '<p>• fmGetRequestTime() = ' . fmGetRequestTime() . '</p>'; echo '<p>• fmGetRequestURI() = ' . fmGetRequestURI() . '</p>'; echo '<p>• fmGetQueryString() = ' . fmGetQueryString() . '</p>'; echo '<p>• fmGetServerAddress() = ' . fmGetServerAddress() . '</p>'; echo '<p>• fmGetServerName() = ' . fmGetServerName() . '</p>'; echo '<p>• fmGetServerPort() = ' . fmGetServerPort() . '</p>'; // echo '<p>• fmGetURL ( \'http://xgravity.net\' ) = ' . fmGetURL ( 'http://xgravity.net' ) . '</p>'; echo '<p>• fmGetUUID() = ' . fmGetUUID() . '</p>'; echo '<p>• fmIsValidEmail ( \'someone@test.com\' ) = ' . fmIsValidEmail('*****@*****.**') . '</p>'; echo '<p>• fmIsValidEmail ( \'someone@testcom\' ) = ' . fmIsValidEmail('someone@testcom') . '</p>'; echo '<p>• fmIsValidURL ( \'http://www.test.com\' ) = ' . fmIsValidURL('http://www.test.com') . '</p>'; echo '<p>• fmIsValidURL ( \'www.test.com\' ) = ' . fmIsValidURL('www.test.com') . '</p>'; echo '<p>• fmStripTags ( \'This is <bold>bold text</bold>. Or not.\' ) = ' . fmStripTags('This is <bold>bold text</bold>. Or not.') . '</p>'; echo '<p>• fmStripTags ( \'This is a <a href="http://www.test.com/">link</a>. Or not.\' ) = ' . fmStripTags('This is <a href="http://www.test.com/">link</a>. Or not.') . '</p>'; // Grab the contents of the output buffer.