File System and Upload Basics



If working on windows and $file_path = "./ac_logs" , the $new_file_path will contain "c:\path_to\ac_logs\" when using "full"

$new_file_path = fixslash( $file_path, "full" );

If working on windows and $file_path = "c:\path_to\ac_logs\" , the $new_file_path will contain "./ac_logs/ when using "basepath"

$new_file_path = fixslash( $file_path, "basepath" );

fixslash will work on linux and makes the file system fully crossplatform. and fixes trailing slash on linux dirs when deleting folders or files

Module Mime Manager

The following will return the uploadpath for the download module, set in

Administration.File Manager->main->download files item

$file_path = getuploadpath( 'download_file' );

If navigating to Administration.File Manager->main-> you can add new extensions to any modules upload form, change file sizes, and add custom FFMPEG commandlines to transcode files

Pagan Uploader

'download_file' if the name of the module item stored in the database, and checks the mime, file sizes, and anything else which is set and allowed for the upload form of the module, create any thumb nails in sub directories, and match input MD5 values, and many other things, most automatically...

$filename = pagan_upload('download_file', $sfile, null, null, true, $chkmd5);

When a upload is complete, the $filename will have an array return like

    $file[$x]['realname'] = $realname;
    $file[$x]['name'] = $filename;
    $file[$x]['path'] = $dfpath;
    $file[$x]['type'] = $filetype;
    $file[$x]['size'] = $filesize;
    $file[$x]['tmp_name'] = $filetmp;
    $file[$x]['displayclass'] = $dfclass;
    $file[$x]['extension'] = $ext;
    $file[$x]['md5sum'] = $md5sum;
    $file[$x]['subdir'] = $subdir;
    $file[$x]['error'] = $error;

the displayclass is the id set to the file mime/extenstion when the mime type is added to a module, display class are the HTML embedded code to display the file, in custom audio and video players, downloads, images etc which can be edited or added by navigating to

Administration.File Manager->display classes and the following function

echo getdisplayclass("download_file", $displayclass, $file_path . "media/thumb/" . $filename, null);