Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in extension-manual & 1 question #12

Closed
freeATweb opened this issue Oct 12, 2016 · 2 comments
Closed

Bug in extension-manual & 1 question #12

freeATweb opened this issue Oct 12, 2016 · 2 comments

Comments

@freeATweb
Copy link

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

@Anubiso
Copy link
Contributor

Anubiso commented Nov 10, 2016

I stumbled upon the same error,

you have to replace

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

with

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

addUploadedFile vs addFile
because the file is already uploaded to the server. Then it works (when everything else is configured correct)

@freeATweb
Copy link
Author

it worked with $storage->addFile()

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants