Ok so video uploads to #friendica kind of suck, I get it, it is not exactly a video platform, but I have made it my all in one social and website, so I created a complex solution to an easy problem, as I want control over where my content is hosted/served from, I made this convoluted script and process for my video uploads, it starts with opening #filezilla and ftping into my /storage/videos folder in my instance, yes I created a folder in /storage labeled videos, after I move the .mp4 into that folder I run a script that I placed in the root of my instance which is called register-video.php and here is the script,

<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

// CONFIGURE THESE:
$friendica_root = '/home/someplace/public_html/your.instance.domain/';
$ftp_folder     = $friendica_root . 'storage/videos/';
$uid            = your user number;

// DATABASE CONFIG:
$db_host = 'localhost';
$db_user = 'your db user';
$db_pass = 'your db password';
$db_name = 'your db name';

// Connect to Friendica database
$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);

if ($mysqli->connect_errno) {
    die("DB ERROR: " . $mysqli->connect_error . "\n");
}

// Debug: show folder
echo "Checking folder: $ftp_folder\n";

// Find all files in FTP folder
$files = glob($ftp_folder . '*');

if (!$files) {
    echo "No files found.\n";
    exit;
}

$allowed = array('mp4', 'webm', 'mov');

foreach ($files as $file) {

    $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));

    if (!in_array($ext, $allowed)) {
        continue;
    }

    $basename = basename($file);
    $filesize = filesize($file);
    $filetype = mime_content_type($file);

    echo "Registering: $basename\n";

    // Read file contents into memory
    $filedata = file_get_contents($file);

    if ($filedata === false) {
        echo "Failed to read file data.\n";
        continue;
    }

    // Create Friendica hash
    $hash = hash('sha256', $basename . microtime(true));

    $created = date('Y-m-d H:i:s');
    $edited  = $created;

    // Insert into Friendica attach table
    $stmt = $mysqli->prepare("
        INSERT INTO attach 
        (uid, hash, filename, filetype, filesize, data, created, edited)
        VALUES (?, ?, ?, ?, ?, ?, ?, ?)
    ");

    $null = NULL;

    $stmt->bind_param(
        "isssisss",
        $uid,
        $hash,
        $basename,
        $filetype,
        $filesize,
        $filedata,
        $created,
        $edited
    );

    $stmt->send_long_data(5, $filedata);

    $stmt->execute();

    $attach_id = $stmt->insert_id;

    echo "Attachment ID: " . $attach_id . "\n";
    echo "Embed using:\n";
    echo "\n\n";

    $stmt->close();
}

echo "Done.\n";

?>

after you have imported your video via ftp to your /storage/videos you go to your cmd that your sshed into and in the root of your instance you run php register-video.php and you should receive

 php register-video.php
Checking folder: /home/someplace/public_html/your.instance.domain/storage/videos/
Registering: somerandom.mp4
Attachment ID: some number will appear here say 00
Embed using:


Done.
then you can embed into your post, yes I created something no one needs or wants, but I wanted and needed it so I am sharing on the off chance someone may find it useful;


⚖️ License (MIT)
Copyright (c) 2026 pasjrwoctx👽 (Philip A. Swiderski Jr.)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

@helpers @developers @admins

You can encourage my continued useless ideas, and by doing so your helping to feed, house and clothe a #disabled man living in #poverty, $5-10-15 It All Helps, via #cashapp at $woctxphotog or via #paypal at paypal.com/donate?campaign_id=…