コード例 #1
0
    $zip = new ZipArchive();
    if ($zip->open(public_path() . '\\' . 'uploads\\' . $zipFileName, ZipArchive::CREATE) === TRUE) {
        // Copy all the files from the folder and place them in the archive.
        foreach (glob($path . '/*') as $fileName) {
            $file = basename($fileName);
            $zip->addFile(realpath($fileName), $file);
        }
        $zip->close();
        $headers = array('Content-Type' => 'application/zip');
        $upload = new Uploads();
        $upload->section_name = $section_values->name_of_section;
        $upload->section_shortname = $section_values->shortname;
        $upload->section_url = $section_values->section_url;
        $upload->sub_section = $section_values->sub_section;
        $upload->file_url = public_path() . '\\' . 'uploads\\' . $zipFileName;
        $upload->save();
        $page = DB::table('sections')->where('id', Input::get('id'))->update(array('upload_status' => "Uploaded"));
    } else {
        return View::make('upload')->withMessage('Creating zip file Failed');
    }
    return View::make('upload')->with(['sections' => $sections]);
});
Route::get('/add', function () {
    $sections = Sections::lists('name_of_section', 'name_of_section');
    $pages = Pages::lists('page_description', 'page_link_value');
    return View::make('edit')->with(['sections' => $sections, 'pages' => $pages]);
});
Route::get('/forms', function () {
    $sections = Sections::lists('name_of_section', 'name_of_section');
    $pages = Pages::lists('page_description', 'page_link_value');
    // $page_values =Pages::where('id', '=',Input::get('id'))->first();