File resources

TYPO3 Flow Resource Management

The documentation [1] on flow.typo3.org about the resource management is already finished. There are some nice examples and the resource management is working good in Flow 1.x

Anyway, when I played around with it some time ago I missed one point, so I try to explain it in a small example. I wanted to upload some csv files and I wanted to work with the data. So this example shows how to upload a file and use the object later on.

Create the upload form

Nothing new here I guess. We just use the Fluid form view helper for creating our form and we set the type of our field to f:form.upload and we are done. Now you can see the input button on your page to select a file you want to upload.

Create the fileUpload action

First part is almost the same like in the example on flow.typo3.org. What took me some time is to find out how I can access the file to work with the data in the file.

It is really easy and I can’t remember what took me so long. What you have to do is to get the uri of the resource object. As soon as you have the resource uri, you can use it like a file name and do, like in my example, an fopen on the file and get the content.

 

Create a download link