I made some changes to the repo, and hopefully these changes are all that is necessary for the uploader to work for everyone. I basically am hand crafting a upload path using FCPATH, which is absolute. I tested it here (Windows/XAMPP) and on community-auth.com (Linux/Litespeed), and all is well. If you guys can do some testing with the new code, I’d appreciate it. Let me know how it goes.
That makes the upload to fail, error given is ‘callback failed’ on JS alert message.
Change again to:
$config['upload_dir'] = 'upload_directory';
So, ok, your comment on $config[‘upload_dir’] is “Upload_dir must be a single public root level directory”, BUT the fact is the file is correctly uploaded to the correct subdirectory, under /projects/sandbox/auth/upload_directory <—- so the upload is CORRECT, no JS alert, the problem is for some reason you’re writing an absolute path to the database: table user_profiles, field profile_image, it gets: /upload_directory/profile_images… instead of the correct location of the file, that landed on /projects/sandbox/auth/upload_directory
And so the div id=“profile_image” gets populated with an img src=”/upload_directory/profile_images”... which is not found
Upload is working, it’s just a matter of database/showing the image problem.
I changed the RewriteBase in my .htaccess to this:
RewriteBase /sandbox/auth/
So at this point, I probably have the exact same thing as you.
1) I went in and fixed the references to images in the style.css file.
2) I changed the file_url() method in MY_Upload to this:
public function file_url( $full_path ) { // Get all URI segments of the file upload location $path_parts = explode('/', $full_path);
// Initialize variable to track if upload_dir has been reached when looping through $path_parts $target_dir = FALSE;
// Initialize variable to hold our image path to pass to base_url() $file_url = '';
// Loop through $path_parts for( $x=0; $x <= count( $path_parts ) - 1; $x++ ) { // If this parth part is the upload_dir, or if the upload_dir has already been reached if( $path_parts[$x] == $this->upload_dir OR $target_dir === TRUE ) { // Build on to the path to pass to base_url() $file_url .= ( $target_dir ) ? '/' . $path_parts[$x] : $path_parts[$x];
$target_dir = TRUE; } }
// Return the URL to the image return base_url( $file_url ); }
Aha, merged and now works. Don’t worry too much, that should be enough for those of us expecting it to work under subdirectories
Just two notes:
1) I don’t understand when you say “Please use a single public root level directory for upload_dir. It won’t work without doing that.”
The image is indeed created into /projects/sandbox/auth/upload_directory, there is no ‘upload_directory’ dir at my webroot. Promise.
2) When I was trying that, I manually erased my profile image file from the upload_directory under ‘sandbox/auth/upload_directory’, just to see it’s being created there. After doing that, upload failed every time with an error about ‘token’ (your csfr protection). Refreshing page or logout/login again didn’t help. I figured out to manually set blank the profile_image field under user_profiles table on database and then upload worked again. Just to let you know.
The reason why the upload dir needs to be a single dir is the file url ( shown above ) method is looking for it to match a segment of the upload path after exploding the path. It would never match if a slash appears in the upload dir.
Next, the uploader doesnt work after deleting the image from the filesystem because the token is instantly used by the 404 created by the missing image. The image would never be missing under normal circumstances.
It did not matter f you had created the upload dir because mkdir() is doing recursive making of dirs, hence the third parameter of mkdir().
Hope everyone now has a good uploader experience. Thanks for testing. I would have never known about this problem, or have been able to fix it, without this feedback.
I just added a custom uploader to Community Auth, and could use some testers. The uploader controls allow for drag and drop re-ordering of images, and drag to trash deleting of images. It uses jQuery UI sortable, droppable, draggable, etc. This uploader not in the isolated downloads yet, only the tip. Anyways, let me know how it goes if you have the time to test it out.
After some trouble with the download link, I eventually did get to download without the site giving a 404. Now on the dowload site I downloaded and set up the module. However, as I am a near virging in CI, I have serious troubvle getting it set up. In your manual you state it is so symple to install, a manual is not needed. I do disagree. I keep getting 404 errors when trying to get to http://localhost/vraagje/index.php/init
There is documentation, and if followed installation is easy, especially if you already have experience with CI. I don’t know what the problem with bitbucket is today, but it sounds like you may have got a corrupt download, because the php error is claiming that a file does not exist. I can send you a zip if you private message me your email address.
Thanks for the help so far, here and over the email.
In case someone else runs into trouble: Check the .htaccess. My problems were based in a htacces file: It assumed CI is in the root of the server. If you install it in a separate directory, the .htaccess file needs adjustment. Sight. Should-have thought of that myzelf!
Thanks for the help so far, here and over the email.
In case someone else runs into trouble: Check the .htaccess. My problems were based in a htacces file: It assumed CI is in the root of the server. If you install it in a separate directory, the .htaccess file needs adjustment. Sight. Should-have thought of that myzelf!
I’m going to make this more clear in the documentation. The documentation needs to be reviewed because it’s a couple of weeks old. Thanks for your feedback.
I’m just starting to work through it, and am a newbie with CI. I have a question regarding how to integrate Community Auth with an existing CI installation? I’ve tried cherry picking the files and folders that looked different, and merging code that was different between other files, but this seems like an insane approach (especially since I’m only about a week into CI coding), and I’m trying to do this with other tools similar to yours (ex. CarboGrid). Seems like an approach that is destined to failure, so again, as a newbie, I’m thinking I’m approaching this the wrong way. I realize this is a more generic question (I apologize for that), but I’m dying to get the Community Auth stuff working, as it looks to be exactly what I’ve been looking for, and one of the reasons I’ve started working with the whole CI framework.
Monkey, just download the newest ‘isolated” version on the downloads page. That version is not pre-installed in CI. The only thing to watch out for is when you have a file that is the same as one in the download, like one of the config files. You just want to see what I put in mine vs yours so you can do whatever it takes to make it work ya know.
Hey Brian - Just wanted to let you know I ended up just downloading the full version. Figured, as a newbie, I was jumping in way too deep off the bat. I do now have Community Auth up and running, and WOW, looks like you really thought of everything.
I did run into two very minor things that tripped me up during the install/setup, and wanted to pass along as possible updates to the documentation to help others. These may be just newbie things, so take these suggestions with that in mind:
A) Step 3 “Edit and Run Init Controller” - you might add a note specifically for the $disabled setting to “set this to FALSE as your first step before trying to run init.php”. I know this seems completely obvious now, but after installing and making all the config changes, I didn’t know what this setting did and left it alone. The result of keeping this TRUE unfortunately looks identical to he issue leatherback reported running into with the .htaccess issue (my log looked identical to his log output), so I ended up spending way too much time tweaking .htaccess stuff. Again, turned out I just hadn’t changed the $disabled setting.
B) Then the first thing to do once you have everything up and running, is go to the “Registration Mode” page to enable registration. Again, very minor, but took me a while to figure out why I couldn’t create registrations, and spent too much time going back through the installation and configuration side of things to figure out what I had wrong.
Again, awesome job on this - I’m amazed at all the features, like the Registration Mode - very complete set of options! I hope to get into it pretty deep next week.