Bug #29508

multipart/form-data cannot be saved!

Added by Andreas Keßler about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
-- undefined --
Category:
Resource
Target version:
-
Start date:
2011-09-06
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Hey guys,

I have a form with an upload for a audio file. Since I changed the enctype of my form to "multipart/form-data" the form could not be saved anymore. No matter if I want to upload a file or not.

Controller and Model were set in the way it is described in http://flow3.typo3.org/fileadmin/manual/nightly/TheDefinitiveGuide/PartIII/ResourceManagement.html

This is my first bug report ever. I hope you find all necessary info in it.

Greets,
Andreas Keßler

Required argument "song" is not set.
20 TYPO3\FLOW3\MVC\Controller\AbstractController::mapRequestArgumentsToControllerArguments()

19 TYPO3\FLOW3\MVC\Controller\ActionController_Original::processRequest(TYPO3\FLOW3\MVC\Web\Request, TYPO3\FLOW3\MVC\Web\Response)

18 TYPO3\FLOW3\MVC\Dispatcher_Original::dispatch(TYPO3\FLOW3\MVC\Web\Request, TYPO3\FLOW3\MVC\Web\Response)

17 TYPO3\FLOW3\MVC\Dispatcher::dispatch(TYPO3\FLOW3\MVC\Web\Request, TYPO3\FLOW3\MVC\Web\Response)

16 call_user_func_array(array, array)

15 TYPO3\FLOW3\MVC\Dispatcher::FLOW3_AOP_Proxy_invokeJoinPoint(TYPO3\FLOW3\AOP\JoinPoint)

14 TYPO3\FLOW3\AOP\Advice\AdviceChain_Original::proceed(TYPO3\FLOW3\AOP\JoinPoint)

13 TYPO3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original::setAccessDeniedResponseHeader(TYPO3\FLOW3\AOP\JoinPoint)

12 TYPO3\FLOW3\AOP\Advice\AroundAdvice_Original::invoke(TYPO3\FLOW3\AOP\JoinPoint)

11 TYPO3\FLOW3\AOP\Advice\AdviceChain_Original::proceed(TYPO3\FLOW3\AOP\JoinPoint)

10 TYPO3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original::blockIllegalRequestsAndForwardToAuthenticationEntryPoints(TYPO3\FLOW3\AOP\JoinPoint)

9 TYPO3\FLOW3\AOP\Advice\AroundAdvice_Original::invoke(TYPO3\FLOW3\AOP\JoinPoint)

8 TYPO3\FLOW3\AOP\Advice\AdviceChain_Original::proceed(TYPO3\FLOW3\AOP\JoinPoint)

7 TYPO3\FLOW3\Security\Aspect\RequestDispatchingAspect_Original::initializeSecurity(TYPO3\FLOW3\AOP\JoinPoint)

6 TYPO3\FLOW3\AOP\Advice\AroundAdvice_Original::invoke(TYPO3\FLOW3\AOP\JoinPoint)

5 TYPO3\FLOW3\AOP\Advice\AdviceChain_Original::proceed(TYPO3\FLOW3\AOP\JoinPoint)

4 TYPO3\FLOW3\MVC\Dispatcher::dispatch(TYPO3\FLOW3\MVC\Web\Request, TYPO3\FLOW3\MVC\Web\Response)

3 TYPO3\FLOW3\MVC\Web\RequestHandler_Original::handleRequest()

2 TYPO3\FLOW3\Core\Bootstrap::handleWebRequest()

1 TYPO3\FLOW3\Core\Bootstrap::run()

Please include more helpful information!


Files

AnimalController.php (3.51 KB) AnimalController.php Carsten Bleicker, 2011-09-11 22:06
Animal.php (2.17 KB) Animal.php Carsten Bleicker, 2011-09-11 22:06
Media.php (1.1 KB) Media.php Carsten Bleicker, 2011-09-11 22:06
New.html (710 Bytes) New.html Carsten Bleicker, 2011-09-11 22:06
#1

Updated by Andreas Keßler about 10 years ago

I use FLOW3 beta 1

#2

Updated by Sebastian Kurfuerst about 10 years ago

  • Status changed from New to Needs Feedback

Hey Andreas,

Can you please post the Fluid form you used for this?

Thanks,
Sebastian

#3

Updated by Andreas Keßler about 10 years ago

Hey Sebastian,

I hope the following form snippet helps
The problem appears if I add the <f:form.upload ... tag in order to upload a file.

Without it I can save and create records.

Bye,
Andi

<f:form action="update" object="{song}" name="song" method="post" enctype="multipart/form-data">

    <div class="column left">
        <section>
            <label for="title">
                Titel*
                <small>Wie heißt der Song?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="title" property="title" />
            </div>
        </section>

        <section>
            <label for="composer">
                Komponist*
                <small>Wer hat diesen Song geschrieben?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="composer" property="composer" />
            </div>
        </section>

        <section>
            <label for="artist">
                Künstler*
                <small>Wer hat diesen Song aufgenommen?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="artist" property="artist" />
            </div>
        </section>

        <section>
            <label for="album">
                Album*
                <small>In welchem Album ist dieser Song erschienen?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="album" property="album" />
            </div>
        </section>

        <section>
            <label for="year">
                Jahr*
                <small>In welchem Jahr ist dieser Song erschienen?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="year" property="year" />
            </div>
        </section>

    </div>

    <div class="column right">

        <section>
            <label for="tonality">
                Tonart*
                <small>Wie ist die Haupttonart des Songs?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="tonality" property="tonality" />
            </div>
        </section>

        <section>
            <label for="bpm">
                Tempo*
                <small>Wie schnell ist der Song?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="bpm" property="bpm" />
            </div>
        </section>

        <section>
            <label for="genre">
                Genre*
                <small>Welchem Genre gehört der Song an?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="genre" property="genre" />
            </div>
        </section>

        <section>
            <label for="originalRessource">
                Datei*
                <small></small>
            </label>
            <div>
                <f:form.upload property="originalRessource" id="originalRessource" />
            </div>
        </section>

    </div>

    <div class="clear">&nbsp;</div>

    <div>
       <section>
            <label style="margin-bottom: 10px">Songtext</label>
            <f:form.textarea class="songtext" cols="20" id="text" property="text" rows="20" />
        </section> 
    </div>

    <p>
        <input class="primary submit button" type="submit" value="Speichern" />
    </p>

</f:form>

#4

Updated by Andreas Keßler about 10 years ago

Hey Sebastian,

I hope the following form snippet helps
The problem appears if I add the <f:form.upload ... tag in order to upload a file.

Without it I can save and create records.

Bye,
Andi

<f:form action="update" object="{song}" name="song" method="post" enctype="multipart/form-data">

    <div class="column left">
        <section>
            <label for="title">
                Titel*
                <small>Wie heißt der Song?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="title" property="title" />
            </div>
        </section>

        <section>
            <label for="composer">
                Komponist*
                <small>Wer hat diesen Song geschrieben?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="composer" property="composer" />
            </div>
        </section>

        <section>
            <label for="artist">
                Künstler*
                <small>Wer hat diesen Song aufgenommen?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="artist" property="artist" />
            </div>
        </section>

        <section>
            <label for="album">
                Album*
                <small>In welchem Album ist dieser Song erschienen?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="album" property="album" />
            </div>
        </section>

        <section>
            <label for="year">
                Jahr*
                <small>In welchem Jahr ist dieser Song erschienen?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="year" property="year" />
            </div>
        </section>

    </div>

    <div class="column right">

        <section>
            <label for="tonality">
                Tonart*
                <small>Wie ist die Haupttonart des Songs?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="tonality" property="tonality" />
            </div>
        </section>

        <section>
            <label for="bpm">
                Tempo*
                <small>Wie schnell ist der Song?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="bpm" property="bpm" />
            </div>
        </section>

        <section>
            <label for="genre">
                Genre*
                <small>Welchem Genre gehört der Song an?</small>
            </label>
            <div>
                <f:form.textfield class="required" id="genre" property="genre" />
            </div>
        </section>

        <section>
            <label for="originalRessource">
                Datei*
                <small></small>
            </label>
            <div>
                <f:form.upload property="originalRessource" id="originalRessource" />
            </div>
        </section>

    </div>

    <div class="clear">&nbsp;</div>

    <div>
       <section>
            <label style="margin-bottom: 10px">Songtext</label>
            <f:form.textarea class="songtext" cols="20" id="text" property="text" rows="20" />
        </section> 
    </div>

    <p>
        <input class="primary submit button" type="submit" value="Speichern" />
    </p>

</f:form>

#5

Updated by Karsten Dambekalns about 10 years ago

  • Assignee set to Sebastian Kurfuerst
#6

Updated by Carsten Bleicker about 10 years ago

same on my side. but it seems not to be the multipart form.
it seems to be the resource upload magic.

my root aggregate has a property to the model Media with @OneToOne.
Media is a Model with one property $originalResource with type \TYPO3\FLOW3\Resource\Resource and @OneToOne and its getter and setter. This seems to fail if i upload a file by <f:form.upload property="media.originalResource" /> it fails.
without this field i can save records. also with multipart form.

i added my files if you want to take a look.

#7

Updated by Carsten Bleicker about 10 years ago

my log says:
11-09-11 22:24:58 3746 CRITICAL ORM Uncaught exception in line 495 of /home/pumatertion/public_html/zoo/Packages/Framework/Doctrine/Classes/ORM/UnitOfWork.php: A new entity was found through the relationship 'Bleicker\Zoo\Domain\Model\Animal#media' that was not configured to cascade persist operations for entity: Bleicker\Zoo\Domain\Model\Media@0000000041c2d791000000006a307bfa. Explicitly persist the new entity or configure cascading persist operations on the relationship. If you cannot find out which entity causes the problem implement 'Bleicker\Zoo\Domain\Model\Media#__toString()' to get a clue. - See also: 2011091122245602fbd5.txt [logged in Doctrine\ORM\UnitOfWork::computeAssociationChanges()]

i dit the following and after this i can save again:

public function updateAction(Animal $animal) {
$this->animalRepository->update($animal);
$this->flashMessageContainer->add('Updated the animal.');
$this->persistenceManager->add($animal->getMedia()); // <= After this it works
$this->redirect('show',NULL,NULL,array('animal'=>$animal));
}

#9

Updated by Andreas Keßler about 10 years ago

Thx for the Link to the Conference package. Uploading works now.
The problem were the wrong annotations in the model
issue can be closed.

#10

Updated by Bastian Waidelich about 10 years ago

  • Category changed from - Error Handler Report - to Resource
  • Status changed from Needs Feedback to Closed

Also available in: Atom PDF