コード例 #1
0
 public function importAction(Request $request)
 {
     if ($request->getMethod() == 'POST') {
         $uploadedFile = $request->files->get('Filedata');
         $document = new Document();
         $timestamp = $request->request->get('timestamp');
         $token = $request->request->get('token');
         $document->setFile($uploadedFile, $timestamp, $token);
         if ($document->upload()) {
             $em = $this->getDoctrine()->getManager();
             return new Response(json_encode(Payment::import($em, $document)));
         }
     }
     return new Response(json_encode(false));
 }
コード例 #2
0
 public function uploadAction(Request $request)
 {
     if ($request->getMethod() == 'POST') {
         $uploadedFile = $request->files->get('Filedata');
         $document = new Document();
         $timestamp = $request->request->get('timestamp');
         $token = $request->request->get('token');
         $document->setFile($uploadedFile, $timestamp, $token);
         if ($document->upload()) {
             $em = $this->getDoctrine()->getManager();
             $em->persist($document);
             $em->flush();
             return new Response('Document uploaded!');
         }
         return new Response('Document NOT uploaded!');
     } else {
         return new Response('Works only throw POST!');
     }
 }