Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function store ()
- {
- // Function to store files
- // Save Category, LogoID as FileName into Database
- // Store file into "Public/logo-template"
- if (Input::hasFile('logo_file'))
- {
- $file = Input::file('logo_file');
- $post = new Post;
- $post->category = Input::get('category');
- $post->logo_id = $file->getClientOriginalName();
- $file_name = $file->getClientOriginalName();
- $file = $file -> move(public_path().'/logo-template',$file->getClientOriginalName());
- $post->save();
- $zip = new ZipArchive;
- $zip_path = public_path().'/logo-template/'.$file_name;
- $zip->open($zip_path);
- $zip->extractTo('./logo-template/');
- $zip->close();
- return 'Saved';
- }
- else
- {
- return 'Fail';
- }
- }
- public function show ()
- {
- $logo_id = Input::get('logo_id');
- $files = array();
- foreach (glob(public_path().'/logo-template/'.$logo_id.'/*.png') as $file) {
- //$files[] = basename($file);
- echo "<img style='width:100px; height:100px; padding:10px;'src='/logo-template/".$logo_id."/".basename($file)."'>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement