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>';
Пример #2
0
// 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>&bull; fmGetDocumentRoot () = ' . fmGetDocumentRoot() . '</p>';
echo '<p>&bull; fmError ( 202 ) = ' . fmError(202) . '</p>';
echo '<p>&bull; fmGetDocumentRoot() = ' . fmGetDocumentRoot() . '</p>';
echo '<p>&bull; fmGetRemoteAddress() = ' . fmGetRemoteAddress() . '</p>';
echo '<p>&bull; fmGetRequestTime() = ' . fmGetRequestTime() . '</p>';
echo '<p>&bull; fmGetRequestURI() = ' . fmGetRequestURI() . '</p>';
echo '<p>&bull; fmGetQueryString() = ' . fmGetQueryString() . '</p>';
echo '<p>&bull; fmGetServerAddress() = ' . fmGetServerAddress() . '</p>';
echo '<p>&bull; fmGetServerName() = ' . fmGetServerName() . '</p>';
echo '<p>&bull; fmGetServerPort() = ' . fmGetServerPort() . '</p>';
// echo '<p>&bull; fmGetURL ( \'http://xgravity.net\' ) = ' . fmGetURL ( 'http://xgravity.net' ) . '</p>';
echo '<p>&bull; fmGetUUID() = ' . fmGetUUID() . '</p>';
echo '<p>&bull; fmIsValidEmail ( \'someone@test.com\' ) = ' . fmIsValidEmail('*****@*****.**') . '</p>';
echo '<p>&bull; fmIsValidEmail ( \'someone@testcom\' ) = ' . fmIsValidEmail('someone@testcom') . '</p>';
echo '<p>&bull; fmIsValidURL ( \'http://www.test.com\' ) = ' . fmIsValidURL('http://www.test.com') . '</p>';
echo '<p>&bull; fmIsValidURL ( \'www.test.com\' ) = ' . fmIsValidURL('www.test.com') . '</p>';
echo '<p>&bull; fmStripTags ( \'This is &lt;bold&gt;bold text&lt;/bold&gt;. Or not.\' ) = ' . fmStripTags('This is <bold>bold text</bold>. Or not.') . '</p>';
echo '<p>&bull; fmStripTags ( \'This is a &lt;a href="http://www.test.com/"&gt;link&lt;/a&gt;. Or not.\' ) = ' . fmStripTags('This is <a href="http://www.test.com/">link</a>. Or not.') . '</p>';
// Grab the contents of the output buffer.