read() ) { if ( strpos( $listImage, '.png', 0 )!=FALSE || strpos( $listImage, '.JPG', 0 )!=FALSE ) { if ( ! copy( $localFolder.$listImage, $root.'/'.$album."/".$listImage ) ) $result=1; } } return $result; } function importAlbumZip( $zipfile, $album ) { if ( !is_file( $zipfile ) ) { error("bad file:".$zipfile); } $tmp= "/tmp/albumServer/".$album."/"; $cmd= "/usr/bin/unzip \"".$zipfile."\" -d ".$tmp; if ( !is_dir( '/tmp/albumServer/' ) ) { mkdir( '/tmp/albumServer/' ); } exec( $cmd ); $myDirectory= dir( $tmp ); $folder= $myDirectory->read(); #'.' $folder= $myDirectory->read(); #'..' $folder= $myDirectory->read(); if ( $folder==FALSE ) { error("no files in ".$tmp); } if ( !is_dir( $tmp.$folder ) ) { $folder= $tmp; } else { $folder= $tmp.$folder ; } $result= importAlbumLocal( $folder, $album ); exec( "rm -r ".$tmp ); return $result; } if ( $_POST['action']=='zipUpload' ) { if ( $_POST['albumName']=="" ) { error( "bad album name" ); } if( isset($_FILES['upload_test']) ) { if($_FILES['upload_test']['error'] != UPLOAD_ERR_OK) { error("Unable to upload file!"); } else { $fileName= $_FILES['upload_test']['tmp_name']; $targetName= "/tmp/albumServer/".$albumName.".zip"; if ( move_uploaded_file( $fileName, $targetName ) ) { importAlbumZip( $targetName, $_POST['albumName'] ); header("Location: albumServer.php"); } else { error("unable to upload file"); } } } else { error( "expected upload"); } } else if ( $_POST['action']=='localImport' ) { importAlbumLocal( $_POST['localDir'], $_POST['albumName'] ); } ?>
Give the album a name. Names must not contain spaces and should be fairly unique.
albumName:

Indicate the name of a zip file on your system that contains JPG or PNG images.
zipfile:

Click zipUpload when ready


OR, if the files are already on the server, use this form:

Give the album a name. Names must not contain spaces and should be fairly unique.
albumName:

Indicate the name of the folder on the server to import that contains JPG or PNG images.
folder:

Click localImport when ready

Return to albumServer