QCubed v4 plugin created for FileUpload

Many third-party plugins are difficult or inconvenient to fit for QCubed-4. Here it was decided to build the Fileupload plugin to fit the QCubed-4 framework as much as possible. Here we use javascript, a bit of jquery and PHP.

See FileUploadBase and UploadHandler class for usage and configuration descriptions and use cases.

Requirements

First, you must check whether the conditions are met:

  1. Does the "upload" directory exist in /project/assets.
  2. Does the "tmp" directory exist in /project.
  3. Please check if the constants 'APP_UPLOADS_URL', 'APP_UPLOADS_DIR', 'APP_UPLOADS_TEMP_URL', 'APP_UPLOADS_TEMP_DIR' exist in https://github.com/qcubed-4/application/blob/master/install/project/includes/configuration/active/2directories.cfg.php#L29

One example

This is just a quick example. Language translations are intended to activate javascript language translation. Currently, English, Estonian and Russian are available. The default language is English.

First you need to know that this plugin has been created with a specific purpose in the direction that if you want to create a new folder in the "upload" directory. Then you must also create a folder with the same name in the existing folders "thumbnail", "medium", "large" with exactly the same depth.

On the left is a simple and dirty example. This is to understand how to upload files to other folders in the upload directory. First, for example, create a new folder called "test" and put the same folder in the "upload", "thumbnail", "medium" and "large" directories. Write "test" in the text box and upload some files. Files are uploaded to the directories "upload/test", "thumbnail/test", "medium/test" and "large/test", etc...

Note: This example uses $_SESSION. Please do not use it in session production. Development and production must use either $_GET or $_POST data passed to options[''DestinationPath''].

Two example

The FileUpload class only deals with uploading files and does not deal with direct file deletion after uploading. Before uploading, you can review the uploaded files again and discard some files. For example, a file manager is suitable for managing files and creating folders.


Example One

Example Two

Add files

Options

Note: If you want to override some properties, the same properties must be overridden to the same value in FileUpload and Uploadhandler.

The rest of the properties can be set as needed.

Property FileUpload UploadHandler
RootPath APP_UPLOADS_DIR APP_UPLOADS_DIR
RootUrl APP_UPLOADS_URL -
TempPath APP_UPLOADS_TEMP_DIR APP_UPLOADS_TEMP_DIR
TempUrl APP_UPLOADS_TEMP_URL -
StoragePath _files _files
FullStoragePath null null
Language (en, et, ru) en -
ShowIcons false -
AcceptFileTypes null null
MaxNumberOfFiles null -
MaxFileSize null null
MinFileSize null -
ChunkUpload true -
MaxChunkSize 5 MB -
LimitConcurrentUploads 2 -
Url null -
PreviewMaxWidth 80 -
PreviewMaxHeight 80 -
WithCredentials false -
ImageResizeQuality - 85
ImageResizeFunction ( imagecopyresampled or imagecopyresized) - imagecopyresampled
ImageResizeSharpen - true
TempFolders - ['thumbnail', 'medium', 'large']
ResizeDimensions - [320, 480, 1500]
DestinationPath - null
UploadExists (increment or overwrite) - increment