Jump to content

flyingdutchman

New Members
  • Posts

    7
  • Joined

  • Last visited

flyingdutchman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi folks, @Jazzman: the nutshell-version: I develop websites with Drupal. Uploading them is a P.I.T.A. because of the fact that every file (3000+) is tossed over (and handshaked I guess) seperately. Solution: Zip the project, upload as one file (10sec instead of 30 min) and unwrap at the other side. The script I showed you looked promising uptill the moment I noticed the minor access-problem I described... @ Josh: Actually I develop every website on my local XAMPP server. Tomorrow I'll give it a shot with SSH (here in Europe it is past 21:30, time for a little nightcap ) It'll be new territory once again. Keep you posted on my progress ... Greetz, Arthur
  2. (loud thinking) .. this is probably never gonna work since opening the unzip.php by browser means that the script is executed as root. It will never allow a anonymous user to change file-permissions or ownership. It surprises me that the unzip, including creation of files works at all! Maybe there is a way to "open/execute" the unzip.php in a ftp commandline-session. In which case I would be logged in to the server .... I have read about php.exe, but that is not recognized as a valid command in my dos-prompt .... Maybe I better get used to the idea that uploading a cms-based website takes me upto 30 minutes .... Arthur
  3. Hi Jazzman (u by any chance play the saxophone like me?) Permission to unzipped items: Directory: in filezilla: adfrw (0755) 33 33 in commandprompt: drwxr-xr-x 1 www-data www-data 4096 Feb 16 13:42 a1 (dir) File: in filezilla: flcdmpe (0644) 33 33 in commandprompt: -rw-r--r-- 1 www-data www-data 8 Feb 16 13:42 aaa.txt I am using a php-script (see below) that is ftp'd to the same directory on server where the zip-file lies. Opening the file (in this case) will trigger the unzip. Normally I have an little interface for selecting the zipfile + other options (delete php-unzipper) Since I cannot detect an upload- / attach button, I'll hand you the code as text. The code was written by a certain Yarms. You can find it at http://php.net/manual/ro/ref.zip.php (needs a bit of scrolling down) Gr. Arthur ------------------------- <?php function unzip($file){ $zip=zip_open(realpath(".")."/".$file); if(!$zip) {return("Unable to proccess file '{$file}'");} $e=''; while($zip_entry=zip_read($zip)) { $zdir=dirname(zip_entry_name($zip_entry)); $zname=zip_entry_name($zip_entry); if(!zip_entry_open($zip,$zip_entry,"r")) {$e.="Unable to proccess file '{$zname}'";continue;} if(!is_dir($zdir)) mkdirr($zdir,0777); #print "{$zdir} | {$zname} \n"; $zip_fs=zip_entry_filesize($zip_entry); if(empty($zip_fs)) continue; $zz=zip_entry_read($zip_entry,$zip_fs); $z=fopen($zname,"w"); fwrite($z,$zz); fclose($z); zip_entry_close($zip_entry); } zip_close($zip); return($e); } function mkdirr($pn,$mode=null) { if(is_dir($pn)||empty($pn)) return true; $pn=str_replace(array('/', ''),DIRECTORY_SEPARATOR,$pn); if(is_file($pn)) {trigger_error('mkdirr() File exists', E_USER_WARNING);return false;} $next_pathname=substr($pn,0,strrpos($pn,DIRECTORY_SEPARATOR)); if(mkdirr($next_pathname,$mode)) {if(!file_exists($pn)) {return mkdir($pn,$mode);} } return false; } unzip("test.zip"); ?>
  4. Hi Jazzman, thanks for sticking with me. These are the settings for the zip-file and the directory in which it is residing: Directory: in filezilla: flcdmpe (0777) 10016 1xxx in commandprompt: drwxrwxrwx 9 arttuur psacln 4096 Feb 17 07:19 sp_unzip Zipfile: in filezilla: adfrw (0777) 10016 1xxx in commandprompt: -rwxrwxrwx 1 arttuur psacln 969 Feb 17 08:46 topdir7.zip How do let php take care of things?? Gr. Arthur
  5. Thnx guys for replying, @Jazzman; same thoughts here: if I can unzip and create files/folders, I should be able to manipulate them ... @ Josh: ... so I tried looping the zip_entries and set owners while file being created: Result .... nothing. Every file and folder is created with owner and group "33 33" .... Is there something wrong with the way I try setting the ownership? >> see code below // ------ Loop entries ----------- while($zip_entry=zip_read($zip)) { $zdir = dirname(zip_entry_name($zip_entry)); $zname = zip_entry_name($zip_entry); $zip_fs = zip_entry_filesize($zip_entry); if(empty($zip_fs)) continue; $zz = zip_entry_read($zip_entry,$zip_fs); $z = fopen($zname,"w"); chmod($z, 0755); chown($z, $my_usr); chgrp($z, $my_usr); fwrite($z,$zz); fclose($z); .... zip_entry_close($zip_entry); }
  6. Hi everybody, I am writing a small php-file for unzipping zip-files on a remote server, using following code: $zip = new ZipArchive; $res = $zip->open($filename); if ($res === TRUE) { $zip->extractTo('./'); $zip->close(); The php unzipfile is uploaded to the same dir as the zipfile. Opening the phpfile in a browser enables me to start off the unzip. Unzipping works just fine, also deleting afterwards of the original zip-file and unzip-php. Problem however is the owner of the newly created files/directories >> everything set to 33 33 Result: I cannot change, delete, rename etc any file / folder anymore (have no root-access on the server) I have googled the issue for 3 hours now, but no workable solutions have come up Is it possible to: 1/ combine the extractTo function with chown in some way? 2/ perform some kind of login before extracting the files? Any hint or suggestion more than welcome! Arthur ps: for those interested, I can send the complete code of the unzip.php
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.