• I thought it would be obvious…upload some files via FTP to the same folder WP uploads to automatically (/uploads/2006/06), and they will show up in “browse all” when I write/edit a post. But no!! Why not? I tried changing perms to 666 like other files in the dir, but no luck there either.

    Actually, wierd-er yet….new uploads are going to /2006/07 (since it’s july!) and the file URIs show /07/ — but the folder /07 doesnt’ show up on filezilla. When I try to create it, it says it’s there. 05 and 06 are showing, but not 07.

    I have the multiple file upload plugin, but it only does 5 at a time. I want to upload masses of files at once, and then link to them. I want them to show in the “browse” area so I can use the nifty little “send to editor” link. ?? Is that difficult to achieve?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter kalico

    (@kalico)

    I realize sometimes posts get ignored when the answer is already here somewhere, but honestly I’ve searched the codex, support, google, plugins….tested and tried everything I can think of so far. I’m not just here wimping out. Does anyone know why, or how to solve this problem? Isn’t there any way to upload multiple images via FTP? Thanks……..

    What are the permissions on the directories?

    Note the directories are likely owned by another user (PHP process).

    Thread Starter kalico

    (@kalico)

    The files which are uploaded from within WP are all 666. I changed the perms on the files I uploaded via FTP to match. Is there something else I should do?

    I didn’t create any new directories, just trying to upload files. I am (semi)happy with uploading files to the existing directories. Still can’t understand why one directory WP created is invisible to me, when the others are not. I haven’t messed with any of those.

    Thanks for answering. ?? ?? ??

    Thread Starter kalico

    (@kalico)

    Ok, let me rephrase my question. Let’s forget the permissions issue for a moment….is WP not *designed* to work this way? Should I not *expect* it to read the files I’ve uploaded to the upload directory, and display them in the “browse” area of the file upload portion when I write/edit a post? Has anyone ever done this before and had it work/not work? I’m beginning to think (from the posts I’ve read) that no one has tried, but I just can’t believe that. There are plugins for uploading multiple files….is that because you simply *can’t* FTP files into the upload directories?

    Some info regarding user credentials and file/directory owners here: WordPress Troubleshooting: Permissions, CHMOD and paths, OH MY!

    Who actually owns those files is determined by your host.

    Thread Starter kalico

    (@kalico)

    Thanks Yosemite…that was very helpful information. I didn’t have FileZilla set to show me owner/group settings. Now that I do, it’s showing everything (the files I uploaded via FTP, as well as those that were done via the WP upload interface) as ftpuser / ftpgroup. So if all the files have exactly the same permissions, owner AND group….yet some are showing in WP and some are not….I am still confused! <sigh> This is my last hurdle to launch….I hope to figure this out soon. Thanks for the input so far!

    Ok, let me rephrase my question. Let’s forget the permissions issue for a moment….is WP not *designed* to work this way? Should I not *expect* it to read the files I’ve uploaded to the upload directory, and display them in the “browse” area of the file upload portion when I write/edit a post?

    I suspect, with no research done, that you nailed it. Ok, I did do a small piece of research that you may benefit from: I noticed, in the wp_postMeta table (substitute wp_ with your prefix, of course) that there are records for each uploaded file…

    The meta_key value is “_wp_attached_file”.
    the meta_value value is the physical location of the image file.

    From that, I’m making a huge leap to the conclusion that the current WP image thingy only sees what it uploaded.

    That being said, I wonder if one of the image manager plugins that have proliferated since WP 2.x came out might do what you’re after?

    Thread Starter kalico

    (@kalico)

    Wow…ok, that is the kind of thing I needed! I don’t know why I didn’t think to check the db, but that might explain the problem.

    I suppose I will check into the various image manager plugins. Since I’m not managing images, but rather doc and pdf files, I have only looked at upload managers, and so far the closest I’ve come is the multiple file upload plugin, which is neat but only does 5 at a time. I have thought about maybe hacking it to do more, but….just plain FTP would be a lot easier with the quantity I’m dealing with. Maybe I can play around with the db and fake it out to think I uploaded via WP…..

    Well, off to browse plugins and contemplate the hacking possibilities…… thanks HandySolo. I’ll be back if I can’t figure this out. ??

    kalico,
    any luck? – I am fighting the same uphill battle here…

    Thx!

    Try Image Manager from https://soderlind.no – or really even better easier faster: Windows Live Writer from https://windowslivewriter.spaces.live.com/?_c11_blogpart_blogpart=blogview&_c=blogpart&partqs=amonth%3d10%26ayear%3d2006 (main post) or the installer download direct: https://g.msn.com/8SEENUS030000TBR/WriterMSI

    [As always, minor caveat with WLW: it adds a couple of non-valid “attributes” into the code when inserting graphics or maps – just delete them if valid code is important to you; they seem to be specific to the sort of stuff they track (*wincing*) at MSN spaces or whatever it is….)

    Kalico and andrabr did you get something working ?

    No solution to automaticaly scans the upload directory and updates the database ?

    Thanks !

    Should be a few lines of code, just have to find the right place to make it a nice way..

    Just to get you going, here some plugin code which might be useful to to add a bunch of files in some directory structure to wordpress post database. They are visible at least.

    Much nicer would be to use wordpress own functions of course.

    <?php
    /*
    Plugin Name: scanuploaddir
    Plugin URI:
    Description: scans upload dir and adds to posts. 
    
    Todo:
    - create thumbnails and add metadata
    - skip already available attachments in posts
    - add option for file-description
    
    Version: 0.1
    Author: HendrikJan
    Author URI:
    */
    
    /*
    License: GPL
    */
    
    // sure we can get this from WP somewhere
    $wp_path="/wp";
    
    /* Add a tab to the administration panel, just below dashboard */
    
    add_action('admin_menu', 'show_tree'); 
    
    function show_tree() {
    	if (function_exists('add_submenu_page')) {
    		add_submenu_page("index.php", "ShowTree", "ShowTree", 10, __FILE__, 'showtree');    }
     }
    
    function addfiles($options){
    	// GENERATES SQL FOR INSERTION
    	global $wpdb,$wp_path;
    	$abspath=realpath(dirname(__FILE__)."/../uploads/");
    	foreach($options as $options){
    		$mimetype=mime_content_type($options);
    		$relpath=str_replace($abspath,"",$options);
    		$filepath=$relpath;
    		$relpath="https://".$_SERVER[HTTP_HOST].$wp_path."/wp-content/uploads".$relpath;
    		$query="INSERT INTO $wpdb->posts (post_status,post_title,post_name,guid,post_mime_type) VALUES ('attachment','$filepath','$filepath','$relpath','$mimetype')";
    		echo $query;
    		echo "<br/>";
    		//$wpdb->query($query); //uncomment for running the insertions
    	}
    }
    
    function listfiles(){
    	// DISPLAYS THE UPLOADS DIR
    	$abspath=realpath(dirname(__FILE__)."/../uploads/");
    	echo $abspath;
    	map_dirs($abspath);
    }
    
    function map_dirs($path) {
    	// MAKES RECURSIVE LIST OF FILES FOR FORM
    	$i=1;
           if(is_dir($path)) {
    		   //echo "<h2>".$path."</h2>";
                   if($contents = opendir($path)) {
                           while(($node = readdir($contents)) !== false) {
                                   if($node!="." && $node!="..") {
                                           $full= $path."/".$node;
    									   if(is_file($full)){
    										   $i++;
    										   $mimetype=mime_content_type($full); //Warning, mime_content_type is depreciated
    										   echo "<br/><input name=\"options[]\" value=\"$full\" type=\"checkbox\" CHECKED> $full $mimetype";
    									   }
                                           map_dirs("$path/$node");
                                   }
                           }
                   }
           }
    }
    
    function showtree () {
    	global $options;
    
    	echo "<pre>";
    	//print_r($_SERVER);
    	echo "</pre>";
    
    	// SHOW FORM
    	_e('<div class="wrap"><h2>List of files in upload dir</h2><p>Please select which files should be added to DB</p><form method="post">');
    
    	listfiles();
    
    	_e('<p class="submit"><input type="submit" name="submit" value="add files" /></p></form></div>');	
    
    	// SUBMIT THE THING
    
    	if (isset($_POST['submit'])) {
    		_e('<div class="wrap">');
    		_e('<H1>Files added:</H1>');
    			addfiles($_POST['options']);
    		_e('</div>');
    	}
    
    }
    
    ?>

    Oops, sorry, next time I will use the wordpress pastebin

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Upload via FTP and see in “browse all”’ is closed to new replies.