settings->title; } zip_entry_close($zip_entry); } } zip_close($zip); } return $rsc_name; } // try catch(Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; return $dir; } } try{ $target_dir = "jclic_uploads/"; $idrsc=basename($_FILES["file"]["name"]); $target_file = $target_dir . $idrsc; $type = $_FILES["file"]["type"]; $uploadOk = 1; $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed'); $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check file type $check = false; foreach($accepted_types as $mime_type) { if($mime_type == $type) { $check = true; break; } } if($check !== false) { if(move_uploaded_file($_FILES['file']['tmp_name'], $target_file)){ // All right, nothing to do $uploadOk = 1; exec("/var/www/jclic-aula/helper.py " . $target_file); //$resource_dir=basename($_FILES["file"]["name"],".jclic.zip"); $resource_dir = current(explode(".", $_FILES["file"]["name"])); //$resource_dir=preg_replace("/\.[^.]+$/", "", $idrsc); echo("
\n"); //print("$dir/$resource"); $indexfile="$target_dir/$resource_dir/index.html"; //print("$indexfile"); if(is_file($indexfile)){ $file=fopen($indexfile,r); while (!feof($file)){ $read = fgets($file,255); if (stristr($read,"")){ $title=strip_tags($read); } } fclose($file); }else{ $title=""; } echo("<div class='rsc_name'>$title</div>"); echo("</div>"); } else { $uploadOk = 0; } } else { echo "File is not a valid zip/jclic resource."; $uploadOk = 0; } } catch(Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } ?>