WordPress.org

Ready to get started?Download WordPress

Forums

WP Photo Album Plus
[resolved] Upload from zip file (19 posts)

  1. aeffemultimedia
    Member
    Posted 2 years ago #

    Hello!

    First of all, thank you very much for this beautiful plugin!

    I have a problem uploading photos in a zip file: after upload I get this error for each photo contained in the zip file:

    Warning: copy() [function.copy]: Unable to access zip:///membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia/Allee.zip#Allee.jpg in /membri/aeffemultimedia/home/wp-content/plugins/wp-photo-album-plus/wppa-upload.php on line 820

    Anyway zipping should be successful, because I get this notice:
    Zipfile Allee.zip extracted.
    Processing files, please wait... If the line of dots stops growing or your browser reports Ready, your server has given up. In that case: try again here.
    Done processing files.
    1 Zipfiles extracted.

    I tried to find out what was wrong but I don't know a lot of php so I couldn't find a solution.

    What could the problem be?

    Thnk you very much,

    aeffemultimedia.

    http://wordpress.org/extend/plugins/wp-photo-album-plus/

  2. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    Please mail me an offendig zip (opajaap at opajaap dot nl) so i can see if it is a php or a wppa problem.

  3. aeffemultimedia
    Member
    Posted 2 years ago #

    The zip file that generates that error is uploaded in my depot at this link: http://aeffemultimedia.altervista.org/home/wp-content/wppa-depot/aeffemultimedia/Allee.zip
    Thank you in advance!

  4. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    I had no problems uploading and unzipping and importing.
    I think your php zip module does not support the zipversion of your files.
    Please check with the hosting provider.

  5. aeffemultimedia
    Member
    Posted 2 years ago #

    I already uploaded photos in a zip file one moth ago and it worked fine; couldn't it be a problem with URLs?
    the file has this path: http://aeffemultimedia.altervista.org/home/wp-content/wppa-depot/aeffemultimedia/Allee.zip
    but zip loads this one: zip:///membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia/Allee.zip#Allee.jpg

  6. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    Did you check the settings WordPress address and Aite address in the WP settings general admin page?

  7. aeffemultimedia
    Member
    Posted 2 years ago #

  8. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    The problem is that aeffemultimedia.altervista.org can not be a part of a pathname, it can only be a part of an url.
    To extract the zip, i must refer the file by its pathname, what you see in an ftp program, that will not be something like ....altervista.org

    So, zip:///membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia/Allee.zip#Allee.jpg looks to me as being correct.

    Can you pls check Table IX item 5: Allow wppa debugging.
    I can see a little more then.

    Just a try: wppa-upload.php line 459 reads:

    $depoturl = get_bloginfo('url').'/'.$source;	// url

    change it into:

    $depoturl = get_bloginfo('wpurl').'/'.$source;	// url

    (Change 'url' into 'wpurl')
    It may work (i hope) or make things even worse...

  9. aeffemultimedia
    Member
    Posted 2 years ago #

    I allowed debugging but I couldn't see debug outputs;
    changing 'url' into 'wpurl' didn't change anything, so I restored 'url'

  10. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    To see debug output, append &debug or ?debug to the addressline, but it does not work on your site.

    I want to know the values of the constants, you can see them at the first part of the last table in the wppa+ settings admin page.
    Example of what i want to know:

    WPPA_ALBUMS 	Albums db table name. 	wp_wppa_albums
    WPPA_PHOTOS 	Photos db table name. 	wp_wppa_photos
    WPPA_RATING 	Rating db table name. 	wp_wppa_rating
    WPPA_COMMENTS 	Comments db table name. 	wp_wppa_comments
    WPPA_FILE 	Plugins main file name. 	wppa.php
    WPPA_PATH 	Path to plugins directory. 	/mnt/webf/d1/15/51893315/htdocs/opajaap/test/wordpress/wp-content/plugins/wp-photo-album-plus
    WPPA_NAME 	Plugins directory name. 	wp-photo-album-plus
    WPPA_URL 	Plugins directory url. 	http://wppa.opajaap.nl/wp-content/plugins/wp-photo-album-plus
    WPPA_UPLOAD 	The relative upload directory. 	wp-content/uploads
    WPPA_UPLOAD_PATH 	The upload directory path. 	/mnt/webf/d1/15/51893315/htdocs/opajaap/test/wordpress/wp-content/uploads/wppa
    WPPA_UPLOAD_URL 	The upload directory url. 	http://wppa.opajaap.nl/wp-content/uploads/wppa
    WPPA_DEPOT 	The relative depot directory. 	wp-content/wppa-depot/admin
    WPPA_DEPOT_PATH 	The depot directory path. 	/mnt/webf/d1/15/51893315/htdocs/opajaap/test/wordpress/wp-content/wppa-depot/admin
    WPPA_DEPOT_URL 	The depot directory url. 	http://wppa.opajaap.nl/wp-content/wppa-depot/admin
  11. aeffemultimedia
    Member
    Posted 2 years ago #

    WPPA_ALBUMS	Albums db table name.	avwp_wppa_albums
    WPPA_PHOTOS	Photos db table name.	avwp_wppa_photos
    WPPA_RATING	Rating db table name.	avwp_wppa_rating
    WPPA_COMMENTS	Comments db table name.	avwp_wppa_comments
    WPPA_FILE	Plugins main file name.	wppa.php
    WPPA_PATH	Path to plugins directory.	/membri/aeffemultimedia/home/wp-content/plugins/wp-photo-album-plus
    WPPA_NAME	Plugins directory name.	wp-photo-album-plus
    WPPA_URL	Plugins directory url.	http://aeffemultimedia.altervista.org/home/wp-content/plugins/wp-photo-album-plus
    WPPA_UPLOAD	The relative upload directory.	wp-content/uploads
    WPPA_UPLOAD_PATH	The upload directory path.	/membri/aeffemultimedia/home/wp-content/uploads/wppa
    WPPA_UPLOAD_URL	The upload directory url.	http://aeffemultimedia.altervista.org/home/wp-content/uploads/wppa
    WPPA_DEPOT	The relative depot directory.	wp-content/wppa-depot/aeffemultimedia
    WPPA_DEPOT_PATH	The depot directory path.	/membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia
    WPPA_DEPOT_URL	The depot directory url.	http://aeffemultimedia.altervista.org/home/wp-content/wppa-depot/aeffemultimedia
  12. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    This looks ok.

    I think the source of the copy is not a problem, but the desitination.

    Could you please insert the following line just before the copy line (820) in wppa-upload.php:

    wppa_dbg_msg('Trying to copy '."zip://".$path."#".$filename.' to '.WPPA_DEPOT_PATH."/".$fileinfo['basename'], '', 'force');

    This will produce two output lines at the top of the import screen like:

    [WPPA+ dbg msg: Trying to copy zip:///mnt/webf/d1/15/51893315/htdocs/opajaap/beta/wp-content/wppa-depot/admin/Allee.zip#Allee.jpg to /mnt/webf/d1/15/51893315/htdocs/opajaap/beta/wp-content/wppa-depot/admin/Allee.jpg]
    [WPPA+ dbg msg: Trying to copy zip:///mnt/webf/d1/15/51893315/htdocs/opajaap/beta/wp-content/wppa-depot/admin/Allee.zip#Baum im Schlossgarten.jpg to /mnt/webf/d1/15/51893315/htdocs/opajaap/beta/wp-content/wppa-depot/admin/Baum im Schlossgarten.jpg]

    If the output you get is similar as above - with aeffemultimedia/home in all 4 pathnames - try again with all rights (CHMOD 777) on /membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia

  13. aeffemultimedia
    Member
    Posted 2 years ago #

    The output is a bit different, also considering to change "opajaap with "aeffemultimedia/home"; this is what I get:

    [WPPA+ dbg msg: Trying to copy zip:///membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia/Allee.zip#Allee.jpg to /membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia/Allee.jpg]

    then for the second image it's the same, only changing filename..

  14. aeffemultimedia
    Member
    Posted 2 years ago #

    Actually i think the problem is the destination folder, because the warning message destination is different from debug's output:

    Warning: copy() [function.copy]: Unable to access zip:///membri/aeffemultimedia/home/wp-content/wppa-depot/aeffemultimedia/Allee.zip#Allee.jpg in /membri/aeffemultimedia/home/wp-content/plugins/wp-photo-album-plus/wppa-upload.php on line 821

  15. aeffemultimedia
    Member
    Posted 2 years ago #

    Sorry, last post was an error..
    Anyway I exlplored my depot and I saw that it was unzipping to be unsuccessful, so I read a bit about PHP & ZIPping.

    I tried to change (ll. 817-820)

    for($i = 0; $i < $zip->numFiles; $i++) {
    	$filename = $zip->getNameIndex($i);
    	$fileinfo = pathinfo($filename);
    	copy("zip://".$path."#".$filename, WPPA_DEPOT_PATH."/".$fileinfo['basename']);

    into
    $zip->extractTo(WPPA_DEPOT_PATH);
    and it works fine..

    Is there any danger?
    Can I keep this new code?
    What's the difference?

  16. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    What i remember from the time i coded this, is that not all php zip versions support this.
    #pragma: if it works it is ok.
    I will look into the code later and probably update it.
    Thanx for your effort.

    There is only one thing - see the comment at the top of the routine about extracting directories - that it is potentially dangerous.

  17. aeffemultimedia
    Member
    Posted 2 years ago #

    Do you mean the thing about creating or not sub-directories?
    I think that if i just take care of the files I upload with my modified upload.php there won't be any problems..

    Anyway thank you for this great plugin.. =)

  18. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, if you give anybody upload rights, some bastard may upload a zipped subdir with an destroyeverything.php file in it.
    Currently only top-level files are extracted and tested if they are picture files, others are deleted. I will expand that to search a posssible tree for non-picture files, but that comes in a later rev.
    If you keep upload rights for yourself and trusted users only, it will do no harm.
    In the next version i will do the following:

    if (true) {
    ... the old code ...
    }
    else {
    ... the new (your) code ...
    }

    so you only have to change true into false to get the same.
    Thsi will be until i expanded the search into possible subdirs.
    So you can still easely update to a newer rev.

  19. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 2 years ago #

    This problem is fixed in version 4.4.4
    We use the simple unzip function.
    The zip may contain sub directories, they will be sanitized and can also contain photos that are importable by selecting the source directory on the import screen.

    It was a lot of work, but i am glad that fixing this lead to functionality enhancements.

    Version 4.4.4 will be available in a few days.
    Regards

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic