Symfony 1.2 File Upload

class mymoduleActions extends sfActions
{
  public function executeUpload($request)
  {
    if ($request->hasFiles())
    {
      foreach ($request->getFileNames() as $uploadedFile)
      {
        $fileName  = $request->getFileName($uploadedFile);
        $fileSize  = $request->getFileSize($uploadedFile);
        $fileType  = $request->getFileType($uploadedFile);
        $fileError = $request->hasFileError($uploadedFile);
        $uploadDir = sfConfig::get('sf_upload_dir');
        $request->moveFile($uploadedFile, $uploadDir.'/'.$fileName);
      }
    }
  }
About

me : yeay its me arun

Tagged with:
Posted in framework, PHP
2 Comments » for Symfony 1.2 File Upload
  1. challisd says:

    I tried this and got an undefined method error. Is there another step?

  2. R Arun Raj says:

    could you please copy paste that error here ?
    so that i can go through it

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>