Giter Club home page Giter Club logo

media_upload's Introduction

Media Upload for TYPO3 CMS

This extension for TYPO3 CMS provides a Fluid widget for (mass) uploading media on the Frontend using HTML5 techniques. Once selected by the User, the Media will be directly uploaded to a temporary space within typo3temp. After the form is posted, uploaded File can be retrieved by an UploadService.

If the form has a "show" step before the final submission, the uploaded images can be displayed by another widget.

The file upload is handled by Fine Uploader which is a Javascript plugin aiming to bring a user-friendly file-uploading experience over the web. The plugin relies on HTML5 technology which enables Drag & Drop from the Desktop. File transfer is achieved by Ajax if supported. If not, a fall back method with classical file upload is used by posting the file. (Though, the legacy approach still need to be tested more thoroughly).

https://raw.github.com/fabarea/media_upload/master/Documentation/Upload-01.png

After a file has been uploaded, the user can validate and possibly remove it from the list.

https://raw.github.com/fabarea/media_upload/master/Documentation/Upload-02.png

Installation

The installation is completed in two steps. Install the extension as normal in the Extension Manager. Then, load the JavaScript / CSS for the pages that will contain the upload widget. The extension assumes jQuery to be loaded:

# CSS
EXT:media_upload/Resources/Public/Build/media_upload.min.css

# JavaScript
EXT:media_upload/Resources/Public/Build/media_upload.min.js

Upload Widget

You can make use of a Media Upload widget. Syntax is as follows:

# Minimum syntax
<mu:widget.upload storage="1"/>

{namespace mu=Fab\MediaUpload\ViewHelpers}

# With some more attributes... We assume we have a property "images" in our model
# and this value could be something different like "documents" or whatever.
<mu:widget.upload allowedExtensions="jpg, png" storage="1" property="images"/>


# Required attributes:
# --------------------
#
# - storage

# Default values:
# ---------------
#
# The Storage identifier to get some automatic settings, such as allowedExtensions, default NULL.
# storage = 1
#
# Allowed extension to be uploaded. Override the allowed extension list from the storage. default NULL.
# allowedExtensions = "jpg, png"
#
# Maximum size allowed by the plugin, default 0.
# maximumSize =
#
# The unit used for computing the maximumSize, default Mo.
# sizeUnit = Mo
#
# Maximum items to be uploaded, default 10.
# maximumItems = 10
#
# The property to be used for retrieving the uploaded images, default NULL.
# property = foo

To see the uploaded images in a second step:

<mu:widget.showUploaded />

<mu:widget.showUploaded property="images" />


# The property to be used for retrieving the uploaded images, default NULL.
# property = foo

Upload Service

Once files have been uploaded on the Frontend and are placed in a temporary directory, we have to to retrieve them and store them into their final location. This code can be used in your controller:

/**
 * @var \Fab\MediaUpload\Service\UploadFileService
 * @inject
 */
protected $uploadFileService;

/**
 * @return void
 */
public function createAction() {

        /** @var array $uploadedFiles */
        $uploadedFiles = $this->uploadFileService->getUploadedFiles()

        # A property name is needed in case specified in the Fluid Widget
        # <mu:widget.upload property="images"/>
        $uploadedFiles = $this->uploadFileService->getUploadedFiles('images')

        # Process uploaded files and move them into a Resource Storage (FAL)
        foreach($uploadedFiles as $uploadedFile) {

                /** @var \Fab\MediaUpload\UploadedFile $uploadedFile */
                $uploadedFile->getTemporaryFileNameAndPath();

                $storage = GeneralUtility::makeInstance(ResourceFactory::class)->getStorageObject(1);

                /** @var File $file */
                $file = $storage->addFile(
                        $uploadedFile->getTemporaryFileNameAndPath(),
                        $storage->getRootLevelFolder(),
                        $uploadedFile->getFileName(),
                        \TYPO3\CMS\Core\Resource\DuplicationBehavior::RENAME
                );

                # Note: Use method `addUploadedFile` instead of `addFile` if file is uploaded
                # via a regular "input" control instead of the upload widget (fine uploader plugin)
                # $file = $storage->addUploadedFile()

                $fileReference = $this->objectManager->get(\YourVendor\YourExtensionKey\Domain\Model\FileReference::class);
                $fileReference->setFile($file);
                $yourDomainObject->addImages($fileReference);
        }
        ...
}

File Configuration in FAL

How to configure a field / property of type file?

SQL

CREATE TABLE tx_domain_model_foo (
        images varchar(255) DEFAULT '' NOT NULL,
);

TCA

$TCA['tx_domain_model_foo'] = array(
    'images' => array(
            'label' => 'Images',
            'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                'images',
                array(
                    'appearance' => array(
                            'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
                    ),
                'minitems' => 0,
                'maxitems' => 1,
            ),
            $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
        ),
    ),
);

Model

Your domain model, should then contain the method addImages for the purpose of $yourDomainObject->addImages($fileReference);. See code above in the Upload Service.

/**
 * Images
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
 */
protected $images;

public function addImages(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
    $this->images->attach($image);
}

File Reference Model

We must extend the FileReference for the purpose of $fileReference->setFile($file);`. See code above in the Upload Service.

namespace YourVendor\YourExtensionKey\Domain\Model;

class FileReference extends \TYPO3\CMS\Extbase\Domain\Model\FileReference {

    /**
     * @params \TYPO3\CMS\Core\Resource\File $file
     */
        public function setFile(\TYPO3\CMS\Core\Resource\File $file) {
                $this->originalFileIdentifier = (int)$file->getUid();
        }
}

Configuration Extbase Persistence

::

Finally we must configure the persistence layer of Extbase. Instead of configuration via typoscript, you now have to create the followin php file: "YourExtensionFolder"ConfigurationExtbasePersistanceClasses.php see: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.0/Breaking-87623-ReplaceConfigpersistenceclassesTyposcriptConfiguration.html

<?php declare(strict_types=1); return [

YourVendorYourExtensionKeyDomainModelFileReference::class => [

'tableName' => 'sys_file_reference', 'properties' => [

'originalFileIdentifier' => [
'fieldName' => 'uid_local',

],

],

],

];

Security

By default Media Upload require a Frontend User to be authenticated. This can be adjusted according to your needs by selecting only allowed Frontend User Group. This behaviour can be configured by TypoScript.

plugin.tx_mediaupload {

        settings {

                # "*", means every authenticated User can upload. (default)
                # "1,2", means every User belonging of Frontend Groups 1 and 2 are allowed.
                # no value, everybody can upload. No authentication is required. Caution!!

                allowedFrontendGroups = *
        }
}

The TYPO3 Behavior of Restriction of allowed / denied Filetypes has changed.

Scheduler tasks

The temporary files contained within typo3temp can be flushed from time to time. It could be files are left aside if the user has not finalized the upload. The Command can be used via a scheduler task with a low redundancy, once per week as instance:

# List all temporary files
./vendor/bin/typo3cms mediaupload:removeTempFiles rundry

# Remove them.
./vendor/bin/typo3cms mediaupload:removeTempFiles

Building assets in development

The extension provides JS / CSS bundles which included all the necessary code. If you need to make a new build for those JS / CSS files, consider that Bower and Grunt must be installed on your system as prerequisite.

Install the required Web Components:

cd typo3conf/ext/media_upload

# This will populate the directory Resources/Public/WebComponents.
bower install

# Install the necessary NodeJS package.
npm install

Then you must build Fine Uploader from the source:

cd Resources/Private/BowerComponents/fine-uploader

# Install the necessary NodeJS package inside "fine-uploader".
npm install

# Do the packaging works. It will create a "_dist" directory containing the build.
grunt package

Finally, you can run the Grunt of the extension to generate a build:

cd typo3conf/ext/media_upload
grunt build

While developing, you can use the watch which will generate the build as you edit files:

grunt watch

Version 3.x Breacking Changes

When upgrading vom Version prior 3 to vesion 3 and cahngeing TPO3 version from 9 to 10, the configuration of the extbase persistance mapping needs to be changed from typoscript to a php class. see section: Configuration Extbase Persistence

The scheduler Tasks should now be run via TYPO3 Commandline command.

Todos for the future

replace signal Slot calls with PSR-14 middleware requests

media_upload's People

Contributors

anubiso avatar evilbmp avatar fabarea avatar kephson avatar markuskappe avatar pitchart avatar powerkiki avatar rvkammen avatar stuartmcfarlane avatar tomita-militaru avatar velletti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

media_upload's Issues

Bug in sanitizeFileNameAndPath

count($pathSegments) === 2 does never be true because there is only one element in the array, I fixed with the following (Classes/Service/UploadFileService.php, line 91):

if (count($pathSegments) === 2 && strpos($uploadedFileName, '..') === false) { $sanitizedFileNameAndPath = UploadManager::UPLOAD_FOLDER . $pathSegments[1]; }
elseif (count($pathSegments) === 1 && strpos($uploadedFileName, '..') === false) { $sanitizedFileNameAndPath = UploadManager::UPLOAD_FOLDER . $pathSegments[0]; }

Localisation for Mo and Ko

My users (and myself TBH) are unfamiliar with the terms Mo and Ko for megabytes and kilobytes.

I'm assuming this is a localisation issue.

Upload with multiple upload fields broken since TYPO3 11 and cureent Github version

If having a form with more than one upload field the upload is broken. First upload field works, second not. The reason is that {uniqueId} is empty. I fixed it by setting {uniqueId} = {widgetIdentifier} in the fluid template:

<f:variable name="uniqueId">{widgetIdentifier}</f:variable>

TYPO3 11 and current github media_upload version 1.0.0 (version number is missing in ext_emconf.php).

upload failed: [FineUploader 4.1.0] Error when attempting to parse xhr response text (Unexpected token <)

I dont get a json respons when i upload a file (image)
The storage has been set to a valid storage in the backend.

I did change the rendering of the plugin: moved the inline JS to an external file loaded in the footer (Jquery is also in the footer) and set the variables as globals. this does work fine.

as response i get the complete html of the page where i added the fluidhelper.

I have no clue where to start debugging.

php 5.4
typo3 6.2

debug :

[FineUploader 4.1.0] Received 1 files or inputs.
[FineUploader 4.1.0] Attempting to validate image.
[FineUploader 4.1.0] Attempting to draw client-side image preview.
[FineUploader 4.1.0] Attempting to determine if 2013-09-28 22.37.06.jpg can be rendered in this browser
[FineUploader 4.1.0] Sending upload request for 0
[FineUploader 4.1.0] '2013-09-28 22.37.06.jpg' is able to be rendered in this browser
[FineUploader 4.1.0] Moving forward with EXIF header parsing for '2013-09-28
[FineUploader 4.1.0] EXIF Byte order is big endian
[FineUploader 4.1.0] Found 10 APP1 directory entries
[FineUploader 4.1.0] Successfully parsed some EXIF tags
[FineUploader 4.1.0] xhr - server response received for 0
[FineUploader 4.1.0] responseText = ...

media_upload:temporaryfile:flush command should only delete older files

Currently media_upload:temporaryfile:flush command is removing all folder and files without questioning.

When run in a wrong time, where a website user is currently submitting files, in theory the users files would be deleted before finishing.

It might be smarter to look at the files creation dates. If they are past a defined period of time, the are more likely save to remove.

Do you have any opinion on that?

getUploadedFiles always returns an empty array

After the successfull upload to the typo3temp I link to a different action. In the actions' controller I try to access the files as described in the manual with: $uploadedFiles = $this->uploadFileService->getUploadedFiles(); but it always returns empty.
Do I have to send some additional params to this action ?

Thanks and best regards,
Stefan.

Update documentation

In TYPO3 11 dependency injection has changed. Therefore the documentation should be updated.

Possibility to set as required?

Hi,

is it possible to set the media upload field to required so that at least one image must be uploaded in order to submit the form?

Thanks in advance!

Missing PermissionUtility

Hi Fabien,
it looks like Fab\Media\Utility\PermissionUtility is missing in this package.
Thanks for providing this utility file

Use in backend modules

Hi.
I can use media_upload Fluid tag in frontend plugings. My question is: Can I use it in backend modules? I tried it, but the button for "Upload a file" does not appear.
Thank you.

How can i use the Extention in EXT:form

Hi,

I would like to use the extention to use it for forms with form. Unfortunately I can't get any further. :(

What are the steps to use this or is there such a thing already ?

uploaded-files not found

Hi,
UploadFileService->sanitizeFileNameAndPath() wants to explode "UploadManager::UPLOAD_FOLDER" from $uploadedFileName.
But media_upload/Resources/Private/Assets/JavaScript/MediaUpload.js removes the UPLOAD_FOLDER part from the filePath.
var basename = uri.replace("/typo3temp/MediaUpload/", "");
uploadedFiles.push(basename);

So $sanitizedFileNameAndPath is empty, because count($pathSegments) will not be 2.

Two Upload-Fields in one form

Hi,

if I use one media_upload field in a form, it works perfect.

Now I tried to use a second field (previewimage and image), but without success.
None of the image-upload-fields work - both return an empty array.

Both fields have the same Configuration (Domain Model, TCA, sql, ...)

Here's the code:


// get file storate from typoscript settings
	$fileStorage = (int)$this->settings['fileStorageID'];

	/** @var array $uploadedFiles */
	$uploadedFiles = $this->uploadFileService->getUploadedFiles('images');
	$previewImage = $this->uploadFileService->getUploadedFiles('previewimage');

	// Bildergalerie Process uploaded files and move them into a Resource Storage (FAL)
	foreach($uploadedFiles as $uploadedFile) {
                /** @var \Fab\MediaUpload\UploadedFile $uploadedFile */
                $uploadedFile->getTemporaryFileNameAndPath();

		$storage = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject($fileStorage);

		/** @var File $file */
		$file = $storage->addFile(
		    $uploadedFile->getTemporaryFileNameAndPath(),
		    $storage->getRootLevelFolder(),
		    $uploadedFile->getFileName(),
		    'changeName'
		);
                // Create File Reference
		$newFileReference = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\MyExt\\Domain\\Model\\FileReference');
		$newFileReference->setOriginalResource($file);
                $newEntry->addImages($newFileReference);
        }


	// Preview Image: Process uploaded files and move them into a Resource Storage (FAL)
	
	foreach($previewImage as $uploadedFile) {
                /** @var \Fab\MediaUpload\UploadedFile $uploadedFile */
                $uploadedFile->getTemporaryFileNameAndPath();

		$storage = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject($fileStorage);

		/** @var File $file */
		$file = $storage->addFile(
		    $uploadedFile->getTemporaryFileNameAndPath(),
		    $storage->getRootLevelFolder(),
		    $uploadedFile->getFileName(),
		    'changeName'
		);
                // Create File Reference
		$newFileReference = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\MyExt\\Domain\\Model\\FileReference');
		$newFileReference->setOriginalResource($file);
                $newEntry->addPreviewimage($newFileReference);
        }

Can someone please help me out :-)

Thanks

Compatibility with TYPO3 10.4 LTS

Hello,

I'm currently working on the compatibility of this extension for TYPO3 10.4 LTS.

  • Replace "PATH_site" with \TYPO3\CMS\Core\Core\Environment::getPublicPath()
  • Files /Classes/FileUpload/Optimizer/Risize.php and Rotate.php:

public function __construct($storage = NULL)
{
$this->storage = $storage;
$this->gifCreator = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Imaging\GifBuilder::class);
$this->gifCreator->absPrefix = \TYPO3\CMS\Core\Core\Environment::getPublicPath();
}

But there is still a problem with the file upload itself.
There is no folder and file created in typo3temp/MediaUpload.
No JAvascript or AJAX-Errors - the preview of the uploaded image shows up (see attachment)

But no file & folder is created (like typo3temp/MediaUpload/5ac514a5-7a95-40ef-a97c-ceecf8929415/dummy-image.jpg)

FineUploaderBasic request option "paramsInBody" is set to false (Ticket #42 )

Can someone help me?

Best regards
media-upload-screen1

allowedExtensions is always false

I am using TYPO3 11 and PHP 8.1, non-composer mode.

Every time i try to select a file i get the alert box, that the file extension ist not allowed, but it is one of the allowed.
I tried different files with the file extensions.

I tried to check the values using in the media_upload.js File if the file extensions are available at this point.
Seems all to be correct.

Actually have no clue to start debugging.

TYPO3 9.5.5 Statuscode 200

Hello,

the extension worked fine with TYPO3 8.7 LTS, but after an update to TYPO3 9.5.5 I get an error:

[Fine Uploader 5.10.1] Error when attempting to parse xhr response text (Unexpected token < in JSON at position 0)

(Statuscode 200, server responded error. Reason unknown)

The /typo3temp/MediaUpload directory and subdirectories are not created.
(tested with chmod 777, [SYS][fileCreateMask] = 0777 and [SYS][folderCreateMask] = 0777)

I also tried to generate the respond-Uri with index.php?id=xx (avoiding the new Routing Enhancers and Aspects) without success.

After a few hours of debugging I've still no idea where the problem is.
Can you help me out?

Thanks a lot

f:format.raw allowedExtensions

Hi,
in TYPO3 8 LTS the variable allowedExtensions must parsed by f:format.raw to prevent the conversion to the html-entities of the apostrophes. Without the result will be var allowedExtensions= ['jpg&#039;,&#039;png'];

Own UploadViewHelper-Template

How can I use my own UploadViewHelper-Template.
I tried:
plugin.tx_mediaupload {
view {
widget {
Fab\MediaUpload\ViewHelpers\Widget\UploadViewHelper {
templateRootPath = EXT:myext/Resources/Private/Templates/
}
}
}
}
But this will not work.

Sizeunit not working anymore

With the current master branch (TYPO3 11 compatible version) the attribute sizeUnit of the viewhelper does not work anymore. I used MB, but it always uses default (kb). I had to add maximumSize="20000000" instead of maximumSize="20".

mu:widget.showUploaded didn't work

Hello,
I have a form where user can upload pdf with widget upload and it's work.
I want to know if it's possible to show uploaded file when user come back to the form and how ?
I tried to user mu:widget.showUploaded with the property of the widget, but when i use this widget, he broke the upload and not load the other file.

this is my html :

<div class="btn-upload">
            <mu:widget.upload allowedExtensions="pdf, PDF" maximumSize="5" maximumItems="3" storage="2" property="identite" />
            <mu:widget.showUploaded property="identite" />
</div>

Can you help me ?
Thanks

PATH_site missing in scheduler task

in Classes/FileUpload/UploadManager.php PATH_site is missing on line 30:
const UPLOAD_FOLDER = PATH_site.'typo3temp/MediaUpload';

Otherwise:
Oops, an error occurred: RecursiveDirectoryIterator::__construct(typo3temp/MediaUpload): failed to open dir: No such file or directory

How can I create a multiple file upload?

I manage to upload several files, but they are not connected to my model. In the table sys_file_reference the uid_foreign is missing.
My model is called Place and has the property images.
I followed the instructions in the manual except for the following modifications:

SQL
My images field is not of type varchar but int.

...
images int(11) unsigned NOT NULL default '0',
...

TCA
In TCA I define the maximum number and the local_table for sys_file_reference

'images' => [
    ...
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
        'images',
        [
            ...
            'maxitems' => 10,
            'foreign_match_fields' => [
                'fieldname' => 'images',
                'tablenames' => 'tx_foejplaces_domain_model_place',
                'table_local' => 'sys_file',
            ],
        ],
        $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    ),
],

Model

class Place extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
     * images
     *
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
     * @cascade remove
     */
    protected $images;

/**
     * __construct
     */
    public function __construct()
    {
        //Do not remove the next line: It would break the functionality
        $this->initStorageObjects();
    }

 /**
     * Initializes all ObjectStorage properties
     * Do not modify this method!
     * It will be rewritten on each save in the extension builder
     * You may modify the constructor of this class instead
     * 
     * @return void
     */
    protected function initStorageObjects()
    {
        ...
        $this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
    }

/**
     * Adds a FileReference
     *
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
     * @return void
     */
    public function addImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
        $this->images->attach($image);
    }

    /**
     * Removes a FileReference
     *
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove The FileReference to be removed
     * @return void
     */
    public function removeImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove) {
        $this->images->detach($imageToRemove);
    }

    /**
     * Returns the images
     *
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
     */
    public function getImages() {
        return $this->images;
    }

    /**
     * Sets the images
     *
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
     * @return void
     */
    public function setImages(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $images) {
        $this->images = $images;
    }
...
}

Controller
In the controller I replaced the line $storage = ResourceFactory::getInstance()->getStorageObject(1); which did not work for me.

/**
     * action create
     *
     * @param \GreenBits\FoejPlaces\Domain\Model\Place $newPlace
     * @return void
     */
    public function createAction(\GreenBits\FoejPlaces\Domain\Model\Place $newPlace)
    {
        $this->addFlashMessage('The object was created.', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING);

        # A property name is needed in case specified in the Fluid Widget
        # <mu:widget.upload property="images"/>
        $uploadedFiles = $this->uploadFileService->getUploadedFiles('images');

        # Process uploaded files and move them into a Resource Storage (FAL)
        foreach($uploadedFiles as $uploadedFile) {

            /** @var \Fab\MediaUpload\UploadedFile $uploadedFile */
            $uploadedFile->getTemporaryFileNameAndPath();

            // $storage = ResourceFactory::getInstance()->getStorageObject(1);
            $resourceFactory = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
            $storage = $resourceFactory->getDefaultStorage();

            /** @var File $file */
            $file = $storage->addFile(
                $uploadedFile->getTemporaryFileNameAndPath(),
                $storage->getRootLevelFolder(),
                $uploadedFile->getFileName(),
                \TYPO3\CMS\Core\Resource\DuplicationBehavior::RENAME
            );

            # Note: Use method `addUploadedFile` instead of `addFile` if file is uploaded
            # via a regular "input" control instead of the upload widget (fine uploader plugin)
            # $file = $storage->addUploadedFile()

            $fileReference = $this->objectManager->get(\GreenBits\FoejPlaces\Domain\Model\FileReference::class);
            $fileReference->setFile($file);
            $newPlace->addImage($fileReference);
        }
       $this->placeRepository->add($newPlace);
      //  $this->redirect('list');
    }

Bug in extension-manual & 1 question

Hi,

at first: awesome extension! :-)

There is a little bug in the manual:

         /** @var File $file */
           $file = $storage->addUploadedFile(
                    $uploadedFile->getTemporaryFileNameAndPath(),
                    $storage->getRootLevelFolder(),
                    $uploadedFile->getFileName(),
                    'changeName'
            );

has to be an array.

         /** @var File $file */
            $file = $storage->addUploadedFile(array(
                    $uploadedFile->getTemporaryFileNameAndPath(),
                    $storage->getRootLevelFolder(),
                    $uploadedFile->getFileName(),
                    'changeName'
              )
            );

One question occured to me while using media_upload in one of my extensions.

I integrated the media_upload as shown in the manual.
When i save the frontend-create-Form, an error occures, which I can't really solve on my own:

{"exception":"TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException: File name is invalid...

The storage folders in /typo3temp/MediaUpload/ are built correctly; the Parameters look OK too.
TCA, Domain Model, sql are correct.
Is it a bug in media_upload or am I missing something in integrating media_upload to my form or controller?

I am looking forward to your reply

Best regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.