Welcome to Geeklog, Anonymous Saturday, December 28 2024 @ 03:09 am EST
Geeklog Forums
Batch import - upload directory setting?
Status: offline
muskrat
Forum User
Chatty
Registered: 10/31/02
Posts: 41
I've been trying to do batch import and I get the message:
Specified upload directory, /home/summbpgc/public_html/ exists but is not writable
No Upload Directory Specified, use setPath() method
I know I can change the public_html to be 777 but that's not safe. I looked for an "upload directory" setting in config.php and could not find one. In admin/user.php it just seems to use _CONF['path'} as the upload directory. That doesn't seem right. Am I missing the setting somewhere? Or do I have to edit admin/user.php to do the set_path() call? What's the proper approach here? What's this upload dir actually used for? It looks like the upload class is trying to save to /tmp and then move it to the upload dir, but in this case why wouldn't the file just stay in /tmp and then get deleted?
Thanks much.
5
4
Quote
timyang
Anonymous
I get the same message as well when I try to upload a tab delimited file for the users batch upload.
If anyone can tell us, what do we change the 'path' to?
2
3
Quote
Status: offline
lcox
Forum User
Junior
Registered: 07/12/02
Posts: 31
Here's how I solved this problem:
in config.php I added a new line:
$_CONF['useruploadpath'] = $_CONF['path'] . 'useruploads/';
in the directory where $_CONF['path'] points, I made a
'useruploads' subdirectory. I did a:
chmod o+rwx useruploads
to allow the web server to access it without problems and because
'path' is out of the accessible web root, it can't be seen by a
browser.
Then in admin/user.php in the importusers() method, I changed the
references to $_CONF['path'] to $_CONF['userploadspath'] in two
places....one in the $upload->setPath() call and the other in the
$filename = $_CONF assignment within the if statement.
The code fragment so you get your bearings looks like this:
// First, upload the file
require_once($_CONF['path_system'] . "classes/
upload.class.php"
$upload = new upload();
$upload->setPath($_CONF['useruploadpath']);
$upload->setAllowedMimeTypes(array('text/plain'));
$upload->setFileNames('user_import_file.txt');
if ($upload->uploadFiles()) {
// Good, file got uploaded, now install everything
$thefile = current($HTTP_POST_FILES);
$filename = $_CONF['useruploadpath'] . 'user_import_file.txt';
} else {
// A problem occurred, print debug information
print 'ERRORS<br>';
$upload->printErrors();
exit;
}
4
3
Quote
All times are EST. The time is now 03:09 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content