I'm working on a custom finisher for ext: Forms / Typo3 Forms.
I added an image upload input to the form. I can fetch the entered form values using getFormValues() of the forms context, however, this returns a TYPO3\CMS\Extbase\Domain\Model\FileReference for image input types.
How do I resolve the file reference to an actual file path? I need to do some extra work on the file itself, before attaching it to an e-mail and sending it out via the Mail API.
getPublicUrl() should help you.
Maybe, you have to transform it into an absolute path, but that should not be difficult.
Related
I am wondering how I can generate a pdf in an extbase extension. What I wanting to do is the following: On saving a record in the backend also a pdf with the data of my record should be generated an saved in the fileadmin for instance.
I have found frontend solutions for generating pdfs with special fluid viewhelpers primarily, but I need it in the backend when the editor saves a record.
Are there any common solutions in extbase for this?
Generating PDFs has no common solution in TYPO3.
Alas you have the option to hook in most actions to use an additional library to generate a PDF of the data you are processing.
You could find more information here
i'm beginner with GXT and i'm wondering if there is a way to parse a file and extract some informations without uploading it.
i created a formpanel that contains an uploadFile form but i don't know waht's next, how to get the complete path of the file so i can read/write with java io or how to retrieve the file or is there an alternatif solution, thank you.
Best Regards.
You can do it in some modern browsers using bleeding edge HTML5 apis for which you would need to use GWT JSNI code. There are no api's from GWT team as is.
HTML5 FileReader
FileReader includes four options for reading a file, asynchronously:
FileReader.readAsBinaryString(Blob|File) - The result property will contain the file/blob's data as a binary string.
FileReader.readAsText(Blob|File, opt_encoding) - The result property will contain the file/blob's data as a text string.
FileReader.readAsDataURL(Blob|File) - The result property will contain the file/blob's data encoded as a data URL.
FileReader.readAsArrayBuffer(Blob|File) - The result property will contain the file/blob's data as an ArrayBuffer object.
Example of GWT wrapper over these -
https://github.com/bradrydzewski/gwt-filesystem
You can read about it more from here - How to retrieve file from GWT FileUpload component?
IMHO you cannot read it .
Due to security reasons javascript(gwt) doesn't have access to the system drives files.
http://en.wikipedia.org/wiki/JavaScript#Security
see Opening a file in local file system in javascript
In order to get the file you need to make a server call.
Instead you can do your validation server side and throw proper messages to user.
P.S : i am not considering modern browser concept.What happens if someone opened in other than so called modern browsers?? Will the programm runs same?? Its always better to do server side validation..
I have created an upload form in Zend which is combined with uploadify to upload multiple files.
The error I keep getting is;
File 'files' exceeds the defined ini size
I have found online that the cause of this error is due to the form not having the enctype set. I have already set it to be
enctype="multipart/form-data"
but I still get the error. The strangest part is that I still get the error even if I have not selected a file to upload?
any ideas?
I get same error when uploading files using jQuery Form Plugin (http://jquery.malsup.com/form/) and no file is selected. I had to disable validation for this element.
Simple ajax call will not allow you to send files to server no matter if form enctype is multipart. Had similar issue for couple days and been trying to look for an answer. Came up with jQuery Form Plugin as Andrey Ovcharov mentioned. But still during validation it failed. The trick is to add couple additional options to ajaxSubmit method:
, iframe:true
, url:your_ajax_url
Also, if you want file elements to be optional - make sure your elements are optional. When using multiple files, during submission prepare form to be ready to validate by looping those items and checking if $element->getFileName() is valid string (keeping it simple len > 0 and sometimes check for not being array).
I also left $element->setAllowEmpty(true); while testing it. Not sure if very important, but when finally got it working - left, can't do any harm :)
P.S. I know, question is 2012y, but I myself was struggling with zend form validation with optional file uploads + ajax call
I am new in Zend Framework and learning it. I want to upload image into my database and display that image in view page. I search lots of tutorial but no step by step guidance. Want a help. Thanks in advance.
You need to take a look on Zend_Form_Element_File in Zend documentation:
The File form element provides a mechanism for supplying file upload
fields to your form. It utilizes Zend_File_Transfer internally to
provide this functionality, and the FormFile view helper as also the
File decorator to display the form element. By default, it uses the
Http transfer adapter, which introspects the $_FILES array and allows
you to attach validators and filters. Validators and filters attached
to the form element are in turn attached to the transfer adapter.
Database side, you need to use a BLOB type to hold your image (I assume you're using MySQL).
However, note that best practices are to store the image path in the database instead of the image itself.
At last, there are tons of tutorials out there that explains precisely how to do what you're looking for, you just need to look for "file upload using zend element file" and you will find them!
We have some custom print code to print an Infopath form on the user's default printer as well as a server-based PDF printer for loading into a document management system. This is working perfectly, but we would like to control the name of the generated PDF file. The PDF print utility can automatically generate a file name using various parameters such as file name, current date/time, etc. Since we cannot programmatically interface with the PDF print utility, the easiest way to control the name of the generated file would be to set the file name in InfoPath and allow the utility to append a date/time stamp.
I have tried setting the form caption as described in the forum thread here and setting the Save As file name as described in the forum thread here, but regardless, the PDF print utility still uses the default form name (Form1, Form2, etc.). Is there another way to set the form name in code?
Thanks in advance for your help!
Have you considered using an InfoPath PDF Converter that you have more control over via a Web Services API?
Have a look at the PDF Conversion Services as well as the PDF Converter for SharePoint. It deals quite well with InfoPath.
Some additional links
Converting using a Web Service call
Converting InfoPath files from a workflow.
Note that I have worked on this product, so I am obviously biased. It works great though.