Guest User

Untitled

a guest
Mar 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public function uploadFile(Request $ file){
  2. $data =Input::file('file');
  3. $informationdata = array('file' => $data);
  4. $rules = array(
  5. 'file' => 'required|mimes:xml|Max:10000000',
  6. );
  7. $validator= Validator::make($informationdata, $rules);
  8. if($validator->fails()){
  9. echo 'the file has not the correct extension';
  10. } else{
  11. XmlParser::load($data->getRealPath());
  12. }
  13.  
  14. private function store($data){
  15. $destinationPath = public_path('uploads\');
  16. $fileName = $data->getClientOriginalName();
  17. $data->move($destinationPath,$fileName);
  18. $xml = simplexml_load_file($destinationPath.$fileName);
  19. }
  20.  
  21. $xml = new SimpleXMLElement($destinationPath.$fileName, null, true);
  22.  
  23. $xml = new DomDocument('1.0', 'utf-8'); // Or the right version and encoding of your xml file
  24. $xml->load($destinationPath.$fileName);
  25.  
  26. $xml_object = simplexml_load_file($request->file('action')->getRealPath());
Add Comment
Please, Sign In to add comment