<?php
require_once '../NSPHPClient/NetSuiteService.php';
$service = new NetSuiteService();
$imgPath = 'C:\Scripts\validateAssistant.js'; //specify the file path
$imgContents = base64_encode(file_get_contents($imgPath)); //get the contents of the file
$file = new File();
$file->folder = new RecordRef();
$file->folder->internalId = "-15";
$file->name = 'validateAssistant.js';
$file->attachFrom = '_computer';
$file->content = $imgContents;
$addRequest = new AddRequest();
$addRequest->record = $file;
$addResponse = $service->add($addRequest);
if (!$addResponse->writeResponse->status->isSuccess) {
echo "ADD FILE ERROR";
} else {
echo "ADD FILE SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}
?>
Tuesday, December 18, 2018
PHP Toolkit 2012.2 Sample Code: Upload files to the File Cabinet
Below is a sample script that demonstrates how to upload a file to the file cabinet using new PHP Toolkit 2012.2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment