Secure Gateway StorageBox offers a global solution for safe and seamless file uploads in a fully isolated environment, ensuring no uploaded file is executed. Whether hosted on-premises or in the cloud, it provides adaptability with the trusted ALSCO domain or the flexibility of your custom domain. Harness the unmatched protection and data integrity of our API, designed to integrate effortlessly with any system.
curl --location --request POST "https://api1.nodesbox.com/index.php?linkurl=external&token=frdecsxE24r35ty453&domain=nodesbox.com" --form "file_from_alsco=@timeout.jpg"
curl: Command-line tool used for making HTTP requests.
--location: Allows `curl` to follow any redirects.
--request POST: Specifies a POST request, commonly used to send data to be processed.
--URL: The API endpoint to which the request is being sent, including authentication or access token and domain specifications.
linkurl: Developers can choose between two options:
--form: Indicates that the data being sent is form data.
file_from_alsco=@timeout.jpg: Uploads the "timeout.jpg" file using the "file_from_alsco" parameter.
https://storage.nodesbox.com/nodesbox.com/2024/08/31/2024_08_31_12076004052_4302079099158962.png
<?php
header("Content-Type: text/plain");
$Domain= "nodesbox.com";
$Token = "frdecsxE24r35ty453";
$File_Path = "1.gif";
$URL = "https://api1.nodesbox.com/index.php?linkurl=external&token=" . urlencode($Token) . "&domain=" . urlencode($Domain);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file_from_alsco' => new CURLFile($File_Path)]);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch);
if (curl_errno($ch))
{
// echo 'cURL Error:' . curl_error($ch);
}
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// echo 'HTTP Status Code: ' . $http_code;
curl_close($ch);
echo $response;
?>
header(): Sets the response type to plain text.
curl_init(): Initializes a cURL session.
curl_setopt(): Sets various options for the cURL session.
CURLFile: Represents a file to be uploaded.
curl_exec(): Executes the cURL session and gets the response.
curl_errno(): Checks if there were any errors during the cURL session.
curl_getinfo(): Retrieves information about the cURL session, like the HTTP status code in this case.
curl_close(): Closes the cURL session.
Note: If you are using WHM, be sure to install php74-php-curl from the PHP extensions in EasyApache 4.
https://storage.nodesbox.com/nodesbox.com/2024/08/31/2024_08_31_12076004052_4302079099158962.png
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload Form</title>
</head>
<body>
<form id="uploadForm" action="https://api1.nodesbox.com/index.php?linkurl=external&token=frdecsxE24r35ty453&domain=nodesbox.com" method="post" enctype="multipart/form-data" onsubmit="SecureGatewaySubmitForm(event)">
<label for="fileToUpload">Select file to upload:</label>
<input type="file" name="file_from_alsco" id="fileToUpload">
<input type="submit" value="Upload File" name="submit">
</form>
<div id="responseOutput"></div>
<script src="https://alscotoday.com/blog/Secure_Gateway_StorageBox/sg_script.js"></script>
</body>
</html>
<html>: Defines the HTML document with the "en" (English) language.
<head>: Contains metadata and links to external resources.
<meta charset="UTF-8">: Specifies the character encoding as UTF-8.
<meta name="viewport" content="width=device-width, initial-scale=1.0">: Sets the viewport properties for responsive design.
<title>: Sets the title of the web page.
<body>: Contains the visible content of the web page.
<form>: Defines a form for file upload.
<label for="fileToUpload">: Labels the file input field.
<input type="file" name="file_from_alsco" id="fileToUpload">: Allows users to select a file for upload.
<input type="submit" value="Upload File" name="submit">: Provides a button to submit the form.
<div id="responseOutput"></div> This div will display the server response
<script></script> This script is repsonse to print server response  
</body>: Closes the HTML Body.
</body>: Closes the HTML document.
https://storage.nodesbox.com/nodesbox.com/2024/08/31/2024_08_31_12076004052_4302079099158962.png
Install-Package System.Net.Http
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace AspNetCoreHttpClientExample.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class UploadController : ControllerBase
{
private readonly IHttpClientFactory _httpClientFactory;
public UploadController(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;
}
[HttpPost("upload")]
public async Task UploadFile()
{
var requestUri = "https://api1.nodesbox.com/index.php?linkurl=external&token=frdecsxE24r35ty453&domain=nodesbox.com";
// Simulating a file upload. Make sure to replace 'filePath' with the actual path to your file.
var filePath = "path_to_your_file/timeout.jpg";
using var stream = System.IO.File.OpenRead(filePath);
using var content = new MultipartFormDataContent
{
{ new StreamContent(stream), "file_from_alsco", "timeout.jpg" }
};
var client = _httpClientFactory.CreateClient();
var response = await client.PostAsync(requestUri, content);
if (response.IsSuccessStatusCode)
{
// Handle the response (e.g., parse JSON, return the result to the caller, etc.)
return Ok(await response.Content.ReadAsStringAsync());
}
else
{
return BadRequest("Error uploading file.");
}
}
}
}
public void ConfigureServices(IServiceCollection services)
{
services.AddHttpClient();
// ... other services
}
https://storage.nodesbox.com/nodesbox.com/2024/08/31/2024_08_31_12076004052_4302079099158962.png
This URL is the direct link to the uploaded file. Once you receive this URL, it can be effortlessly integrated into your software or application. You can use it to access, share, or store the file as per your requirements.
For a hands-on demonstration of the API's functionality, check out our example page: example.html.
For additional details and advanced API features, please visit alscotoday.com.