Download the PHP package ns/file-upload-bundle without Composer

On this page you can find all versions of the php package ns/file-upload-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package file-upload-bundle

File Upload Bundle

A simple bundle to handle file uploads and url generation.

Install

Via Composer

Configuration

Define a configuration

Configurations are defined as services. For each naming / file location define a tagged service. You can choose any of the provided file namers, or implement your own. Only one of the second or third parameters are required, however both can be used as well.

Given the above configuration. A file uploaded using this configuration would be stored in web/uploads/applicant-uploads/HASH/ClientOriginalName_RANDSTR.ext

You are free to implement your own file and/or directory namers. Simply implement the NS\FileUploadBundle\Namer\FileNamerInterface or NS\FileUploadBundle\Namer\DirectoryNamerInterface.

The bundle comes with the following file naming strategies.

OriginalNamer

This stores the uploaded file using the name provided by the client when uploaded. Service id @ns_file.namer.client_original

OriginalRandomNamer

Similar to the OriginalNamer, this will keep the original filename, but inserts random characters and numbers after the name but before the file extension. This is the default file namer. Service id @ns_file.namer.original_random

RandomNamer

This renames the file to a random string but keeps the original file extension. Service id @ns_file.namer.random

UniqueHashNamer

This performs a sha1 hash of the original client name and uses that plus the original file extension. Service id @ns_file.namer.unique_hash

Usage

When handling a file upload. Simply request the upload handler service. Pass it the instance of the UploadedFile, the configuration and optionally any additional data that the directory namer will use.

Upload Handling

Based on our example configuration above will take the source file and place it in web/uploads/applicant-uploads/63a710569261a24b3766275b7000ce8d7b32e2f7/funny-cat-image_xx12xa.jpg. It will then return a File instance for this. You can save the filename however you'd like.

Downloads / Twig

There is a twig helper which will allow the generation of download urls for any given file.

Provides a link to this file.

License

MIT, see LICENSE.


All versions of file-upload-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/framework-bundle Version ^6.0
symfony/form Version ^6.0
symfony/asset Version ^6.0
twig/twig Version ^2.0||^3.0
ircmaxell/random-lib Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ns/file-upload-bundle contains the following files

Loading the files please wait ....