permanaj

check file upload

Aug 15th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. :: Body request ::
  2.  
  3. ---------------------------acebdf13572468
  4. Content-Disposition: form-data; name="ProfilePic"; filename="power of life.jpg"
  5. Content-Type: image/jpeg
  6.  
  7. <@INCLUDE *C:\Users\Hp\Pictures\power of life.jpg*@>
  8. ---------------------------acebdf13572468--
  9.  
  10.  
  11. :: how I check ::
  12.  
  13. // if there are profile pic
  14. if ($request->files->has('ProfilePic')) {
  15. $profilePic = $request->files->get('ProfilePic');
  16. $user->upload($profilePic);
  17. }else{
  18. $view = $this->view(array('StatusCode' => 400, 'ErrorDesc' => 'No profile picture found'), 400);
  19. return $this->handleView($view);
  20. }
  21.  
  22. :: fos_rest config ::
  23.  
  24. fos_rest:
  25. param_fetcher_listener: true
  26. body_listener: true
  27. format_listener: true
  28. view:
  29. view_response_listener: 'force'
Advertisement
Add Comment
Please, Sign In to add comment