I'm building a typo3 extension and in a backend plugin I want to build a image upload form. I seem not to get the correct $_Files url. The following fluid form is used:
<f:form action="customerSliderImages" id="customerSliderImages">
<f:form.upload name="custSlider[sliderimage]" />
<f:form.submit value="Upload" />
</f:form>
I want to have the [name] and [tmp_name] to store the image, but I don't get the correct url. Also I don't know to echo $_Files for debugging. I tried the following but not working:
$_FILES["tx_mtclnt_user_mtclntmtcus"]["tmp_name"]["custSlider"]['sliderimage']
$_FILES["tx_mtclnt_user_mtclntmtcus"]["name"]["custSlider"]['sliderimage']
It seems you did not define the enctype attribute on the <f:form> tag.
<f:form ... enctype="multipart/form-data"> ... </f:form>
See also:
http://www.w3schools.com/tags/att_form_enctype.asp
http://wiki.typo3.org/Fluid#f:form
Related
Hi i want to use captcha in an html form in a Symfony 3.4 project , i installed and implemented the captcha bundle (Gregwar's CaptchaBundle)successfully but in the bundle's documentation in the part of adding the captcha to the form they are working with symfony form builder but i am working with normal HTML form using requests .
this is the code they provided in the bundle's documentation :
<?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ...
$builder->add('captcha', CaptchaType::class); // That's all !
// If you're using php<5.5, you can use instead:
$builder->add('captcha', 'Gregwar\CaptchaBundle\Type\CaptchaType');
// ...
this is my html form where i want to add the captcha
<form class="row" method="post" action="{{path('envoyerchat')}}">
<input type="text" name="test2">
<input type="text" name="test1">
<!-- add captcha here -->
<!-- add captcha here -->
<input type="submit">
</form>
can i convert that code which works with fom builder to my html form ?
This is the method in Normal HTML to accept only PDF
<input type="file" name="myFile" accept="application/pdf" />
But How to use it with Typo3 Fluid? When I gave like this
<f:form.upload name="myFile" accept="application/pdf" />
It showed me an error as below
#1237823695: Argument "accept" was not registered.
How can I do this in fluid?
(I'm using Typo3 7.6.21)
you can do this with additionalAttributes.
Here a link to the Fluid doc
https://fluidtypo3.org/viewhelpers/fluid/master/Form/UploadViewHelper.html
Complete ViewHelper Code looks like:
<f:form.upload additionalAttributes="{accept :'application/pdf'}" name="test2"/>
I am playing around a bit with Perl and auto-filling out forms. However, when I view the source code and paste the "action" URL of a form into my browser, it goes to a "Page Not Found". How could this be? If data is able to be submitted to a page then wouldn't the page have to exist? Or am i just missing something?
For instance, the HTML looks like:
<form action="/Pages/somepage">
<input type="text" name="email" />
<input type="submit" />
</form>
So if i go to http://thewebserver.com/formPage/Pages/somepage it simply displays a "Page Not Found" error.
Thanks.
If the form action is "/Pages/somepage", then the correct full URL will be http://thewebserver.com/Pages/somepage, not http://thewebserver.com/formPage/Pages/somepage. Not sure where you got that "formPage" from.
I have tried a form submit with files example all the files are getting uploaded to XTRF and getting the response.
Now I am using blueimp jquery file uploader[http://blueimp.github.io/jQuery-File-Upload/]. If I upload image files it is getting uploaded to XTRF. If I upload any other files it is not getting uploaded to XTRF. I am getting workfile.rtf as response with junk data.
Please help me in solving this issue.
Need to upload files to XTRF using ajax uploader.
POST /system/session/files
Accepts files encoded as multipart/form-data and stores them temporarily (they are available only within current session). Each file gets its own id and basic statistics: number of characters (with and without spaces), words, lines, pages.
sample html form for file upload
<form id="upload" action="baseURL/system/session/files" method="post" enctype="multipart/form-data">
<label>Select a file:</label>
<input type="file" name="file" size="45"></input>
<input type="submit" value="Upload"></input>
</form>
You can also send plain text assigned to parameter content encoded as application/x-www-form-urlencoded. Such text will be stored as uploaded file.
sample html form that sends text for upload
<form id="sourceText" action="baseUrl/system/session/files" method="post" enctype="application/x-www-form-urlencoded">
<label>Source text:</label>
<textarea name="content" rows="5" columns="40"></textarea>
<input type="submit" value="Save"></input>
</form>
Uploaded files can be attached to quote request or while updating user's profile.
In my webapplication, a JSP page outputs to the webpage, the list of users logged in that day. I want to mail the same output to specifics mail-ids. What all Struts2 tags do I need to use?
Grab the HTML using JavaScript and send it as request parameter.
<div id="content">
... (here you should put content which you'd like to mail)
</div>
<form action="mail" method="post" onsubmit="html.value = encodeURIComponent(document.getElementById('content').innerHTML)">
<input type="hidden" name="html" />
<input type="submit" value="Mail this document" />
</form>
It'll be available as request parameter with name "html" in Struts2/Servlet side. The emailing job can be done with help of JavaMail.