php - Symfony: uploading a file without sfWidgetFormInputFile()
i'm trying to develope a file uploading system for my symfony app. I tryed to use the sfWidgetFormInputFile object, but did'nt know how to use it >_<. Now i'm trying to do it traditionally, with a code like this in the view:
<form action="<?php echo url_for('home/saveFile')?>" method="post">
<input type="file" id="file" name="file">
<input type="submit" value="Upload">
</form>
How can i access the submitted file information in the action class?
PS: I think i did something wrong in the form because in the symfony dev bar, in config section, in global subsection, there is a parameter called 'files' and is empty. The sent files should be there, right?
Thank you very much for your time! :D
Answer
Solution:
The
sfWidgetFileInputFile
is a much better way of doing what you want to do ... but if you really want to do it manually - this is what you need in youraction.class.php
function ->(where
$request
is ansfWebRequest
object)