Support ⇒ Coppermine ⇒ Juploader for Coppermine ⇒ Community Forums ⇒ CPG Dragonfly™ CMS

Juploader for Coppermine Reply to topic

Author Message
Kinsman
Dragonfly addicted
Dragonfly addicted

Offline Offline
Joined: May 29, 2006
Posts: 475
Location: Australia
Post
Found this excellent mod by Klaus the other day. Basically it allows users to upload multiple pics at a time, rather than an admin having to do batch uploads. Pretty cool really and looks the bomb, except it stops after 1 pic with the following error.

1:40:26.103 [INFO] Debug level set to 3
01:40:26.105 [INFO] Current debug output file: C:\Users\Trevor\AppData\Local\Temp\jupload_7857934687955206412_log.txt
01:40:26.107 [DEBUG] maxChunkSize<0 which is invalid. Switched to the default value (Long.MAX_VALUE)
01:40:26.107 [DEBUG] maxFileSize<0 which is invalid. Switched to the default value (Long.MAX_VALUE)
01:40:26.122 [DEBUG] uploadPolicy parameter = DragonflyCMSUploadPolicy
01:40:26.150 [WARN] Invalid int value: , using default value: 0
01:40:26.157 [INFO] JUpload plugin for DragonflyCMS version 0.9.2.1
01:40:30.532 [DEBUG] Action : Browse ...
01:40:56.994 [DEBUG] Action : Upload
01:41:15.725 [ERROR] wjhk.jupload2.exception.JUploadExceptionUploadFailed: wjhk.jupload2.policies.DragonflyCMSUploadPolicy.checkUploadSuccess(): The string "SUCCESS" was not found in the response body (wjhk.jupload2.policies.DragonflyCMSUploadPolicy.checkUploadSuccess(): The string "SUCCESS" was not found in the response body)
01:41:15.726 wjhk.jupload2.exception.JUploadExceptionUploadFailed: wjhk.jupload2.policies.DragonflyCMSUploadPolicy.checkUploadSuccess(): The string "SUCCESS" was not found in the response body
01:41:15.726 at wjhk.jupload2.policies.DefaultUploadPolicy.checkUploadSuccess(DefaultUploadPolicy.java:612)
01:41:15.726 at wjhk.jupload2.upload.DefaultFileUploadThread.doUpload(DefaultFileUploadThread.java:735)
01:41:15.726 at wjhk.jupload2.upload.DefaultFileUploadThread.run(DefaultFileUploadThread.java:487)
01:41:19.071 [WARN] DragonflyCMSUploadPolicy.afterUpload: No file were uploaded! (0)


I have no idea why its not Returning "Sucess" when the first pic uploads fine unfortunately.

Shame as its a brilliant album creator too!

Mod can be found here.

www.terralights.de/ter...id=11.html

I'm really hoping we can fix this one, as it makes Coppermine fair easier to use. Very Happy


Kinsman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0
View user's profile Visit poster's website
layingback
Forum Admin
Forum Admin

Offline Offline
Joined: Apr 19, 2004
Posts: 1303
Location: Andalucia
Post
Can't help you with your Java based solution, but I do have a multiple upload to coppermine routine included with Pro_News for Admins which you could use. It uses an existing multiple upload javascript routine by Stickman. No other code required. Please respect and include both mine and Stickman's copyright if you include the code.

It works like - and uses - the current standard browser upload image but lets you select multiple individual images before you do the upload.

Also on my site I have a instructions on how to make this available to members. Modding the new code for members too is easy, but you'll also have to allow members' access to Batch Upload and patch 1 bit of code. I don't know and therefore cannot advise on the merits and/or risks of making Batch Upload available to users, particularly as it relates to security, so you do so at your own risk, YMMV, etc.

_________________
Pro_News CM™ - Content Management for Dragonfly CMS™ - Now Released as Version 4

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux / 1.3.42 - 2.2.12 / 5.1.72 / 5.4.21 / 9.4
View user's profile Visit poster's website Photo Gallery
Kinsman
Dragonfly addicted
Dragonfly addicted

Offline Offline
Joined: May 29, 2006
Posts: 475
Location: Australia
Post
Sounds good, I also posted this on the Jupload forums, in case Etienne gets time to take a look.

I recently had a go at setting up Pro news itself, but failed miserably, didn't even get one article to diplay. Embarassed


Kinsman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0
View user's profile Visit poster's website
layingback
Forum Admin
Forum Admin

Offline Offline
Joined: Apr 19, 2004
Posts: 1303
Location: Andalucia
Post
Kinsman wrote
I recently had a go at setting up Pro news itself, but failed miserably, didn't even get one article to diplay. Embarassed


Sounds like something went seriously wrong!?! Happy to help, want to advise details on my site, eg which version?

BTW, new version of Pro_News in beta currently, for release in about a week.

_________________
Pro_News CM™ - Content Management for Dragonfly CMS™ - Now Released as Version 4

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux / 1.3.42 - 2.2.12 / 5.1.72 / 5.4.21 / 9.4
View user's profile Visit poster's website Photo Gallery
Kinsman
Dragonfly addicted
Dragonfly addicted

Offline Offline
Joined: May 29, 2006
Posts: 475
Location: Australia
Post
Nps, was latest 2 weeks ago, I think it just hated our theme.

As for this Mod, I fixed it!!! Big grin

Add echo "SUCCESS";

to the very bottom of upload_picture.php and it works like a charm.

Nice touch to add titles and descriptions afterwards too. Cool


Kinsman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0
View user's profile Visit poster's website
Kinsman
Dragonfly addicted
Dragonfly addicted

Offline Offline
Joined: May 29, 2006
Posts: 475
Location: Australia
Post
Damn, looks like the latest security fix has broken this great mod, well not broken so muchas left it behind.

I'll post the code here in case someone is able to update it to match the latest code.

<?php /* * Author: Etienne Gauthier (etienne_sf@sourceforge.net) * * This page manages the upload http request. Its aim is to: * - Add the uploaded files into the database * - Calculate the thumb and normal picture. * - return a status to the applet, by writting one simple line. This return is: * SUCCESS (if everything is Ok) * ERROR: Error message (if some problem occurs) */ if (!defined('CPG_NUKE')) { exit; } require('modules/'.$module_name.'/jupload/picmgmt.inc'); header("Content-Type: text/plain; charset=UTF-8"); if (isset($_POST['jupart']) && isset($_POST['jufinal'])) { $chunkedUpload = true; $jupart = intval($_POST['jupart']); $jufinal = intval($_POST['jufinal']); } else { $chunkedUpload = false; } //If the maxFileSize is defined in the Jupload configuration, it overrides the Coppermine configuration if ($CONFIG['maxNonTransformedPictureSize'] > 0) { $CONFIG['max_upl_size'] = $CONFIG['maxNonTransformedPictureSize']; } $escrow_array = $file_failure_array = array(); $i = 0; foreach ($_FILES as $name => $f) { if ( !isset($_FILES[$name]) ) { die($stringUploadError.': '.'no userpicture received'); } $file_name = $f['name']; $file_tmp_name = $f['tmp_name']; $file_size = $f['size']; $file_md5 = md5_file ($file_tmp_name); $max_file_size = $CONFIG['max_upl_size'] << 10; if (!is_uploaded_file($f['tmp_name'])) { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => NO_POST); } else if (empty($f['tmp_name'])) { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => 'no file_tmp_name'); } else if ( !isset($_POST['md5sum'][$i]) ) { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => 'no md5 checksum'); } # else if (!$chunkedUpload && ($file_md5 != $_POST['md5sum'][$i])) { # $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => 'md5 checksum failure'); # } else if ($file_size <= 0) { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => NO_FILE_SIZE); } else if ($file_size > $max_file_size) { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => EXC_FILE_SIZE); } else if ( ($failure=handle_uploaded_file($f)) != '') { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => $failure); } /* if ($chunkedUpload && $jufinal) { $uploaded_pic = $escrow_array[$i]['path'].$escrow_array[$i]['temporary_name']; if (file_exists($uploaded_pic)) { if (md5_file($uploaded_pic) != $_POST['md5sum']) { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => 'md5 checksum failure'); } } else { $file_failure_array[] = array('failure_ordinal' =>$i, 'file_name' =>Fix_Quotes($file_name), 'error_code' => 'no file'); } } */ $i++; } if (count($escrow_array) == 0) { //What's up doc ? $error_reason = ''; if (!empty($file_failure_array)) { //Ok, we have some news of the error in this array $error_reason = '(' . $file_failure_array[0]['failure_ordinal'] . ', ' . $file_failure_array[0]['file_name'] . ', ' . $file_failure_array[0]['error_code'] . ' )'; } echo ($stringUploadError.': no file uploaded '.$error_reason); } else if (!$chunkedUpload || ($chunkedUpload && $jufinal)) { $album = (isset($_POST['album']) && is_numeric($_POST['album'])) ? intval($_POST['album']) : ((isset($_GET['album']) && is_numeric($_GET['album'])) ? intval($_GET['album']) : die('ERROR: '.PARAM_MISSING.': aid' ) ); if (!GALLERY_ADMIN_MODE) { $alb_cat = "SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='$album' and (uploads = 1 OR category = '" . (USER_ID + FIRST_USER_CAT) . "')"; } else { $alb_cat = "SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid='$album'"; } if (($result = $db->sql_query($alb_cat, true)) && $db->sql_numrows($result)){ $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $category = $row['category']; } else { die ($stringUploadError.': '.UNKNOWN_ALBUM); } $errstr=''; // Test if picture requires approval global $USER_DATA; $approved = intval(GALLERY_ADMIN_MODE || defined('BATCH_MODE') || (!$USER_DATA['priv_upl_need_approval'] && $category == FIRST_USER_CAT + USER_ID) || (!$USER_DATA['pub_upl_need_approval'])); foreach ($escrow_array as $escrow) { if (!jupload_add_physical_file($album, $category, $approved, $escrow['actual_name'], $escrow['temporary_name'], $errstr)) { echo $stringUploadError.': '.$errstr; exit; } } // Test if picture requires approval if (!$approved) { echo($stringUploadSuccess."\r\nNEED APPROVAL\r\n"); } else { echo $stringUploadSuccess,"\r\n"; } #after_upload(); } else { //If we come here, we are in chunk mode, but we didn't receive the last one. echo("Chunk $jupart received\r\n".$stringUploadSuccess."\r\n"); } echo "SUCCESS";


Kinsman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0
View user's profile Visit poster's website
Kinsman
Dragonfly addicted
Dragonfly addicted

Offline Offline
Joined: May 29, 2006
Posts: 475
Location: Australia
Post
Files can be downloaded here

www.junglewraiths.net/...upload.zip

it can be seen in action here, and I've increased the debug level to 3.

www.junglewraiths.net/...le=jupload


Kinsman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0
View user's profile Visit poster's website
Kinsman
Dragonfly addicted
Dragonfly addicted

Offline Offline
Joined: May 29, 2006
Posts: 475
Location: Australia
Post
Ok thats weird, seems to be working fine today! Embarassed


Kinsman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.18-164.11.1.el5xen/2.2.13/5.0.89-community-log/5.2.11/9.3.3.0
View user's profile Visit poster's website
Display posts from previous:
All times are UTC



Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


User Info

Welcome Anonymous



(Register)
Community

Support for DragonflyCMS in a other languages:

Deutsch
Español