forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Uploading => Topic started by: mstralka on July 23, 2004, 04:37:20 am

Title: Cross-platform Batch Uploading
Post by: mstralka on July 23, 2004, 04:37:20 am
Before I discovered coppermine today, I had built my own photo management site which sucks compared to this.  I got sick of uploading files individually, so I found a tool called JUpload http://jupload.biz/ (http://jupload.biz/) that I used to let my friends upload their photos to their own folders on the site.  It's a java applet that can be integrated into your site and customized by changing the applet parameters.  The documentation (well-written, professional looking PDF) lists all of the parameters and appropriate values.  Anyway, I got this tool to work on my site in about 2 hours, and it made it a lot easier for my friends to upload their photos.

I've read some other posts on this forum that cautions against granting batch upload access to users.  JUpload can use standard HTTP POSTs or GETs to transfer the files to Coppermine's standard upload processing page.  I'm not a lawyer, but I believe JUpload is free for private and educational use, which is what my site is.  For commercial use, the licenses start at $62.

I'm new to Coppermine and I don't know if there is API documentation, but if any experienced Coppermine programmers want to take a stab at making JUpload work with Coppermine, I'd be happy to share what I've done on my personal site.  I'm going to work on it too, so I'll share any progress I make

Take care
Mark

[edit GauGau 2006-01-29]
This mod has been ported for cpg1.4.x as well - see http://forum.coppermine-gallery.net/index.php?topic=27138.0
[/edit]
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on July 23, 2004, 10:22:05 am
It can't be bundled with coppermine releases if it's not under GNU GPL, but as third-party app (hack/mod, name it how you like) this sounds interessting. Please keep us updated on the progress you make, some screenshots would be nice as well.

GauGau
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on July 24, 2004, 12:18:56 am
Is there any API documentation for CPG or should I just look at upload.php and figure out where to make changes?
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on July 24, 2004, 01:09:36 pm
there's no API documentation available publicly yet, sorry (Tarique is currently working on this). You could just take a look at the db entries in the pictures table to see what queries to produce. You will have to check the authentification mechanisms (init.inc.php and functions.inc.php basically) as well.

GauGau
Title: Re: Cross-platform Batch Uploading
Post by: Tarique Sani on July 24, 2004, 02:21:59 pm
I really had liked Jupload when I had last seen it almost a year ago- pity it is commercial.  Take a look at upload.php - it is just a matter of providing correc parameters to the function add_picture() (which is written in picmgmt.inc.php)

Title: Re: Cross-platform Batch Uploading
Post by: mstralka on July 26, 2004, 03:11:19 am
JUpload is commercial, but free for private or educational use...
I got JUpload to work with CPG.  This should make uploading much easier for users, provided they have Java and can use applets.

EDIT 8/27 - SEE NEW VERSION BELOW
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on July 26, 2004, 07:06:05 am
could you share your hack, e.g. post your modifications in detail? Thanks.

GauGau
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on July 27, 2004, 12:48:47 am
EDIT 8/27/04: See new version below
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on July 27, 2004, 02:45:43 am
EDIT: See new version
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on July 27, 2004, 07:57:37 am
##Modified files:
upload.php - moved functions to upload_functions.php - added code to display JUpload applet if user has permission
groupmgr.php - groups need to have permission to use JUPLOAD - added permission field 'can_use_jupload'
includes/functions.inc.php - modified authentication to work with JUpload - pass cookies as GET parameter because I couldn't get JUpload cookie parameter to work lang/english.php - added a few labels
That's the important bit you should be more specific about if this mod is suppossed to be usefull for anyone. Usually, you give detailed instructions like
Quote
edit file xxx.php, find
Code: [Select]
fooand replace with
Code: [Select]
bar. Then find
Code: [Select]
whateverand add after it
Code: [Select]
something

GauGau
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on July 28, 2004, 11:52:48 pm
EDIT 8/27/04: See new version below
Title: Re: [CPG1.3.1]: Cross-platform Batch Uploading
Post by: psychozz on August 08, 2004, 09:48:49 pm
Found one error:

You should replace:

Code: [Select]
<tr>
        <td class="tableh1" colspan="2"><b><span class="statlink">{$lang_groupmgr_php['group_name']}</span></b></td>
        <td class="tableh1"><b><span class="statlink">{$lang_groupmgr_php['disk_quota']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_rate']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_send_ecards']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_post_com']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_upload']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['approval_1']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_have_gallery']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['approval_2']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['upload_form_config']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['custom_user_upload']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['num_file_upload']}</span></b></td>
 <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['num_URI_upload']}</span></b></td>
</tr>

With:
Code: [Select]
<tr>
        <td class="tableh1" colspan="2"><b><span class="statlink">{$lang_groupmgr_php['group_name']}</span></b></td>
        <td class="tableh1"><b><span class="statlink">{$lang_groupmgr_php['disk_quota']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_rate']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_send_ecards']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_post_com']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_upload']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['approval_1']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_have_gallery']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['approval_2']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['can_use_jupload']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['upload_form_config']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['custom_user_upload']}</span></b></td>
        <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['num_file_upload']}</span></b></td>
  <td class="tableh1" align="center"><b><span class="statlink">{$lang_groupmgr_php['num_URI_upload']}</span></b></td>
</tr>


Otherwise it seems to work fine, but I still want to be able to upload more than 20 pictures at a time. I upload around 100 pictures each time so a hack that fixes zip upload would be very nice!
Title: Re: [CPG1.3.1]: Cross-platform Batch Uploading
Post by: mstralka on August 08, 2004, 11:13:30 pm
I still want to be able to upload more than 20 pictures at a time. I upload around 100 pictures each time so a hack that fixes zip upload would be very nice!

20 is a practical limit, but you can change this by editing upload_functions.php.  I've uploaded 40 at a time.
In function jupload_applet():
FIND:
Code: [Select]
<!-- Maximums page 37-->
 <param name="maxNumberFiles" value="20">
 <param name="maxNumberFilesWarning" value="You can only upload 20 photos at a time.">
 <param name="maxNumberFilesTitle" value="Upload limit">

Change that number to whatever you want, or get rid of those parameters completely.  Read the JUpload documentation for more info on what each parameter does.
Title: Re: [CPG1.3.1]: Cross-platform Batch Uploading
Post by: RatKing on August 20, 2004, 09:21:25 pm
I know this might be a little silly question but what version of Jupload did you use, I have been messign about with this and it simply doesn't seem to send any parameters to jupload.php other than:
Other than that it seems to work quite well, execpt for the time estimation when uploading files but that might be because my connection her at work is slightly faster than the norm.  ;D
Title: Re: [CPG1.3.1]: Cross-platform Batch Uploading
Post by: mstralka on August 23, 2004, 12:23:54 pm
I know this might be a little silly question but what version of Jupload did you use, I have been messign about with this and it simply doesn't seem to send any parameters to jupload.php other than:
  • control
  • unique_id
  • cookie
It also sends file_upload_request=1.

What else would you like it to send?  Those 4 variables are all it needs to process the photos.
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on August 27, 2004, 05:54:02 pm

This MOD was updated on 9/23/04 to work with CPG 1.3.2.  Please use JUpload 0.75 - the newer versions seem to have some problems (thanks to Lapino for catching this)

Changes:
Removed jupload.php - integrated all JUpload functionality into upload.php and wrote step-by-step instructions
After uploading multiple photos, you can now edit all of their descriptions at once, instead of editing one, clicking next, editing another, and so on.  (I will make this feature available as a separate MOD for those who don't want to use JUpload.)

The instructions were too long to post so please download the attachment
Title: Re: Cross-platform Batch Uploading
Post by: YUKAHO89 on September 12, 2004, 11:41:07 am
Can any on upload a origanal gallery comined with jupload ?
PLease
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on September 12, 2004, 01:56:01 pm
Can any on upload a origanal gallery comined with jupload ?
PLease


I'm not sure what you mean.  Do you want to see an example?  It's used on my site everyday.
http://www.photo-junky.com
Sign in with email: cc@stralka.com
password: tester
Title: Re: Cross-platform Batch Uploading
Post by: YUKAHO89 on September 12, 2004, 04:59:43 pm
I dun know where to add this function and
after i have add the code in the php
the upload page comes blank
so i mean that can you upload a origanal gallery's
files  with the jupload


this function
Code: [Select]
function jupload_applet() {
//create the jupload applet
$unique_ID = substr(md5(microtime().getmypid()), 0, 8);
global $HTTP_COOKIE_VARS, $CONFIG;
global $lang_upload_php;
//convert the cookies into a string to append to the query string
//I could not get the browserCookie parameter to work properly with CPG so I pass it as a GET parameter.
//Not the best way to do it.
$cookieEnc = base64_encode(serialize($HTTP_COOKIE_VARS));
starttable("100%", $lang_upload_php['jupload_title'], 2);
echo <<<EOT
<tr>
<td colspan="2">
{$lang_upload_php['jupload_instr_1']}
</td>
</tr>
<tr>
<td colspan="2">
<applet
  code="JUpload/startup.class"
  archive="jupload.jar"
  width="500"
  height="300"
  mayscript="mayscript"
  name="JUpload"
  alt="JUpload applet">
 <!-- From Page 30 upward -->
 <!-- Java Plug-In Options -->
 <param name="progressbar" value="true">
 <param name="boxmessage" value="Loading JUpload Applet ...">
 <param name="boxbgcolor" value="#e0e0ff">
 
 <!-- Position & Size Page 38-->
 <param name="mainSplitpaneLocation" value="300">
 <!--Position the lower-left message window from the top-->
 <param name="leftSplitpaneLocation" value="150">

 <!-- Target links -->
 <param name="actionURL" value="upload.php?control=phase_1&file_upload_request=1&unique_ID=$unique_ID&cookie=$cookieEnc">
 <param name="completeURL" value="upload.php?control=phase_2&unique_ID=$unique_ID&cookie=$cookieEnc">
 
 <!-- CUSTOMIZATIONS FOR COPPERMINE -->
 <param name="tagName" value="file_upload_array">


 <!-- Filters -->
 <param name="imageFileFilter" value="true">
 <param name="hideShowAll" value="true">

 <!-- Messages -->
 <param name="showSuccessDialog" value="false">
 <param name="successDialogMessage" value="Photos uploaded successfully">
 <param name="successDialogTitle" value="Upload Successful">

 <!-- Maximums page 37-->
 <param name="maxNumberFiles" value="999">
 <param name="maxNumberFilesWarning" value="You can only upload 999 photos at a time.">
 <param name="maxNumberFilesTitle" value="Upload limit">


 <!-- Server -->
 <!-- These all need to be false for the redirect to completeURL to work properly -->
 <param name="showServerResponse" value="false">
 <param name="checkResponse" value="false">
 <param name="realTimeResponse" value="false">

 <!-- Colors -->
 <!-- This could easily be customized to match the theme in use-->
 <param name="backgroundColor" value="#e0e0ff">

 <!-- Switches -->
 <param name="showStatusPanel" value="true">

 <!--Recursion -->
 <param name="useRecursivePaths" value="false">

 <!-- Thumbnails -->
 <param name="showThumbnails" value="false">

 <!-- IF YOU HAVE PROBLEMS, CHANGE THIS TO TRUE BEFORE CONTACTING SUPPORT -->
 <param name="debug" value="false">

 Your browser does not support applets. Or you have disabled applet in your options.
 To use this applet, please install the newest version of Sun's java. You can get it from <a href="http://www.java.com/">java.com</a>

</applet>
</td>
</tr>

EOT;
endtable();
}
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on September 12, 2004, 05:27:51 pm
That function goes anywhere in upload.php, probably near the other functions.

Did you read the instructions completely?
Code: [Select]
## Author Notes: Download and install jupload from [url]http://jupload.biz[/url]
## Put JUpload.jar in the same directory as your coppermmine files or modify
## function jupload_applet() to point to it
## I recommend you install my Multiple Edit mod first:
## [url]http://forum.coppermine-gallery.net/index.php?topic=9391.new;[/url]

Have you followed the instructions and gone to http://jupload.biz and installed the Java applet file on your web server?
Legally, I cannot distribute that piece so you will have to get it yourself.

I've attached my upload.php (renamed it to upload.txt).  I think I have other modifications on it so I'm not sure if it will work for you

Hope that helps
Mark
Title: Re: Cross-platform Batch Uploading
Post by: Lapino on September 22, 2004, 01:39:34 am
Everytime after I have uploaded some pictures, I get the following error:

Script called without the required parameter(s).

I also tried using Mark's upload.php above, but I get the same error. Anyone got an idea? I'd really like to include this in my gallery.
Title: Re: Cross-platform Batch Uploading
Post by: Rufl on September 22, 2004, 06:50:53 pm
Same error for me!
I've noticed that i'm using 1.3.1 and this upload.php that Mark posted is from 1.3.2.
Maybe it is that?
 ???
I'll try a upgrade from 1.3.1 to 1.3.2 to see if any changes happen.

Title: Re: Cross-platform Batch Uploading
Post by: Rufl on September 22, 2004, 10:06:04 pm
Nope..

It continues the same way.. :(

Any ideas?
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on September 23, 2004, 12:49:51 am
Did you make all of the necessary changes to:
Your database table
lang/english.php
groupmgr.php
include/functions.inc.php
include/init.inc.php
upload.php - double-check all changes to this file because the file is long and complicated so make sure you put everything in exactly the right spot

My computer crashed so I am working on getting a fresh install working.  I will walk through my instructions again on a fresh install and see if I get any problems.

-Mark
Title: Re: Cross-platform Batch Uploading
Post by: Rufl on September 23, 2004, 01:03:37 am
Hi guys,
i've got just my two cents to put here, so here we go.

I'm trying to get Jupload working with CPG, with no success.
I've figured out that i needed to mod some files and put the applet on the folder, ok.
Then I discovered that the mod (Cross-platform Batch Upload) includes other mod (Multi-File Uploader)
for full working (moving photos accordingly and editing titles at once), and later i saw that the other
mod incorporated another mod (Frogfoot's fancy album dropdown MOD) and needed it to work properly.

I've wasted some hours today trying to comprehend all those mods that recommend
another mods and that depend on other mods to work, etc etc etc and I know
that i'm not that stupid but i'm not an experienced programmer too, but i really think
it would be better if you guys (devs and contributors) try to create a repository for all
those mods that are lost here on the forums - and attach the files, modded from scratch from the
original files and please, only put dependance on other mods if it was essencial to the
complete funcionality.  ???

I'm speaking from a user point of view, cause i really can't consider myself a good
programmer, but i for sure tried every step from those mod tutorials, even upgraded CPG to do it,
followed the manual and all the steps involved on the process, even analysed and compared files using diff
to find the changes on files and i'm still stuck.  :(

Nothing against those guys work, that i have nothing to complain about, of course, but I think
that as I am stuck, other people will get stuck too, and to avoid general waste of time from you
guys and for us users, i think it would be better an unification of the mods that are dependant of each other.
 ;)

And again, thanks Mark, Frogfoot and all the others that create those excellent mods and extend the funcionality
and the quality of this excelent tool that is Coppermine!

I'm just sorry that maybe i'm not so smart to make them work on my installation...  :\'(
Title: Re: Cross-platform Batch Uploading
Post by: Lapino on September 23, 2004, 01:22:21 am
I think Rufl has a point here, putting these mods together should make it easier, but hey, on the other hand it's easier this way for people who just want a part of the functions of these mods.

Now I do consider myself a programmer (but not very experienced in PHP), but I do have problems with this mod. Now I know I could go dig trough all te code and try to find where I went wrong during install, but I tried retrying the install 3 or 4 times allready, and got a little bit pissed off with it. Maybe I'll try again some other time, but if anyone else has an idea, just shoot.

I use as 1.3.2 fresh install, on an apache server with PHP 4.3.8.
Title: Re: Cross-platform Batch Uploading
Post by: Rufl on September 23, 2004, 01:56:43 am
Hey Mark,

thanks for the quick answer!

Checked all the code, Mark, including the db, files, etc...
I'll try the little mods installfest again tomorrow, but i would really
appreciate if you could find some time to
do that fresh install that you mentioned!

And please, attach the fresh files for us!!

Thanks again and keep up the good work!

-Rufl

P.S.: Lapino, if i achieve any success on this, i'll send you those files, okay?
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on September 23, 2004, 07:58:55 am
I understand your concerns, that's why we're incorporating a plugin API for the next version of coppermine that let's you apply mods easily. Dependancies between mods are new, however - afaik only the mods mentioned in this thread depend on each other.
However, I have to point this out: mods posted in this board are user contributions. There's no guarantee they will work for everyone, or they are easiy to apply. The coppermine dev team will incorporate mods they find usefull for the majority of users into the devel version. Unless bigger projects (e.g. SMF or phpBB), we don't have the manpower to build a mod team that will look into mods, test them, stream-line them and put them into a repository. If anybody wants to join the team as a "mods-guy": you're welcome to say so.

Joachim
Title: Re: Cross-platform Batch Uploading
Post by: Lapino on September 24, 2004, 02:07:58 am
I just found out that the problem isn't the code, it's the applet! I noticed Mark used Jupload 0.75 on his site, while I had 0.79. I just downloaded 0.75 and put it on my server, and BANG: everything works just fine. Although installing an older version of the applet should fix the problem, I'll have a look if I can find a way to make it work with 0.79.
But I'll have to be quick, 'cause in one week time, I'll only have access to the internet in the weekends, so maybe other people should have a look too.
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on September 24, 2004, 03:35:04 am
Good catch Lapino!  I built this mod in July so the JUpload developers have probably changed something since then.  In fact, going to Jupload's forums, it looks like the last few versions have had some bugs, so I suggest sticking with 0.75.  I am not going to investigate using v.79 (because my installation is working fine), but they have very good documentation that should provide some insight into what changed between .75 and .79.

To Rufl's suggestions about MOD dependencies - The JUpload mod should work fine without the other mods (including the ones I suggest as pre-reqs).  I just went through the instructions from a fresh install of CPG 1.3.2 with Jupload 0.75 and did encounter a script-parameter error, but only when I uploaded one picture, and it went away if I hit the refresh button.  If I uploaded 2 or more pictures it seemed to work fine.
I'm pretty sure this didn't happen when I wrote the mod, but I've tracked the problem down:
in upload.php:
Code: [Select]
if (isset($_REQUEST['unique_ID'])) {

            // The unique ID is set, so let us retrieve the record.
$cayman_string = retrieve_record($_REQUEST['unique_ID']);
For some reason, the record retrieval function fails, even though the $_REQUEST['unique_ID'] variable is defined and the record it tries to retrieve does exist in the temp_data table in the database (I checked with phpMyAdmin).  That makes me think that something is screwy with the mysql_query command in the newest version of PHP (wild guess).  Or the result is getting cached somewhere (maybe I forgot to close a result set somewhere).

SO... as a workaround, try this:
FIND:
Code: [Select]
// The user has files that need to be processed and placed in albums.
    // We must pull that information from the temporary data file
    // whose ID is in $_POST['unique_ID'].
if (isset($_REQUEST['unique_ID'])) {

            // The unique ID is set, so let us retrieve the record.
$cayman_string = retrieve_record($_REQUEST['unique_ID']);

            // Verify record was retrieved.
            if (!$cayman_string) {

cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);
Replace with (or just add the header(..) line:
Code: [Select]
    // The user has files that need to be processed and placed in albums.
    // We must pull that information from the temporary data file
    // whose ID is in $_POST['unique_ID'].
if (isset($_REQUEST['unique_ID'])) {

            // The unique ID is set, so let us retrieve the record.
$cayman_string = retrieve_record($_REQUEST['unique_ID']);

            // Verify record was retrieved.
            if (!$cayman_string) {

//I don't know why this works, but it seems to solve the "script missing parameter problem when you
//try to upload only one photo
header("location: " . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']);

                cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);

Also try this:
upload.php
FIND:
Code: [Select]
    array('unique_ID', $_POST['unique_ID'], 4),
Replace with:
Code: [Select]
    array('unique_ID', $_REQUEST['unique_ID'], 4),

I haven't gone through and re-applied the other pre-req mods.  I don't have time.  I've attached the corrected upload.php here.  I didn't have any problems with the other files in the directions so I'm not attaching them.

I hope this helps
Mark
Title: Re: Cross-platform Batch Uploading
Post by: Lapino on September 24, 2004, 03:49:55 am
Well, using Jupload 0.79, it was the same line causing a problem, so maybe with these fixes, it'll work with 0.79 too, but I'm not going to try it now. Firstly because now it's finally working, I don't want to screw it, and secondly, because it's almost 4 AM over here, so I'd better get some sleep  :-\\
Title: Re: Cross-platform Batch Uploading
Post by: fayoeu on September 26, 2004, 08:21:05 am
I unzipped the tar and downloaded your upload.txt file and overwrote my upload.php file.  I can load up the page with the java applet initializing, but I am getting the error message 'Script called without the required parameter' after the file has been sucessfully uploaded.   I don't know what I am doing wrong.  I am running coppermine 1.3.2, no mods except for this one.  Oh, I also modifed lang/english and added your lines pertaining to the jupload according to the direction above.  --Thanks.
Title: Re: Cross-platform Batch Uploading
Post by: fayoeu on September 26, 2004, 09:09:45 am
I solved the problem, but downgrading to jupload 0.75.  Also used the latest posting of the upload.txt file posted in this thread.  I was being stupid and didn't read the end of the thread.  It works fine for me now.
Title: Re: Cross-platform Batch Uploading
Post by: JJ Photo on September 28, 2004, 09:33:14 pm
This didn't work for me.   I got a blank page for batch uploads as well as file uploads.  :(  I followed the steps as carefully as I could.
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on September 29, 2004, 12:59:44 am
JJ,
I'm beginning to think you have other issues with your website or serious problems following directions  :)
This MOD does not impact the batch upload page at all, so that problem is unrelated.
Title: Re: Cross-platform Batch Uploading
Post by: YUKAHO89 on October 11, 2004, 06:03:20 pm
i hv some error in my upload.php

when i load it
it's...

Parse error: parse error, unexpected $end in D:\Apache2\htdocs\cpg\upload.php on line 2821

Here is my php file

the last note is line 2821 i dun know y
Title: Re: Cross-platform Batch Uploading
Post by: mstralka on October 11, 2004, 11:19:18 pm
You didn't attach your upload.php file.  You'll need to rename it to upload.txt before uploading.  What other MODs do you have installed?  Follow the instructions again because this mod works if it's followed correctly.

-Mark
Title: Re: Cross-platform Batch Uploading
Post by: djbabytroja on October 18, 2004, 01:05:59 pm
Hi...

@mstralka

Why this hack when i upload someting with Jupload dont delete the previews in the edit folder????

Greetings
Title: Re: Cross-platform Batch Uploading
Post by: djbabytroja on October 19, 2004, 05:12:29 pm
And me again...

and another bug...

When u allowegd 10 normal file uploads ... 2 file upload forms have only function... the other eight are still there but no function... i test this on mstralka Gallery and my Gallery too... he have the same BUG in his own Gallery...  :-\\

i think the bug is in this CODE...

Code: [Select]
$file_upload_array = array();
$iCnt = count($_FILES);
//JUpload Modification Mark Stralka 7/25/2004
for ($i = 0; $i <= $iCnt; $i++) {
if ($_POST) {
if (isset($_FILES['file_upload_array']['name'][$i])) {
$file_upload_array['name'][$i] = $_FILES['file_upload_array']['name'][$i];
$file_upload_array['size'][$i] = $_FILES['file_upload_array']['size'][$i];
$file_upload_array['tmp_name'][$i] = $_FILES['file_upload_array']['tmp_name'][$i];
$file_upload_array['type'][$i] = $_FILES['file_upload_array']['type'][$i];
$file_upload_array['error'][$i] = $_FILES['file_upload_array']['error'][$i];
}
} else {
if (is_array($_FILES['file_upload_array' . $i])) {
$file_upload_array['name'][$i] = $_FILES['file_upload_array' . $i]['name'];
$file_upload_array['size'][$i] = $_FILES['file_upload_array' . $i]['size'];
$file_upload_array['tmp_name'][$i] = $_FILES['file_upload_array' . $i]['tmp_name'];
$file_upload_array['type'][$i] = $_FILES['file_upload_array' . $i]['type'];
$file_upload_array['error'][$i] = $_FILES['file_upload_array' . $i]['error'];
} else {
$i = $iCnt;
}
}
}

    $file_upload_count = count($file_upload_array['name']);


Greetings...
__________________________________________________________

I found the bug, the upload.php "phase 1" dont give the right number of $_FILES... i have this solution...

Code: [Select]
    $file_upload_array = array();
$iCnt = NUM_FILE_BOXES;
$iCntt = count($_FILES);
//JUpload Modification Mark Stralka 7/25/2004
for ($g=0; $g <= $iCnt; $g++) {
for ($i=0; $i <= $iCntt; $i++) {
if ($_POST) {
if (isset($_FILES['file_upload_array']['name'][$g])) {
$file_upload_array['name'][$g] = $_FILES['file_upload_array']['name'][$g];
$file_upload_array['size'][$g] = $_FILES['file_upload_array']['size'][$g];
$file_upload_array['tmp_name'][$g] = $_FILES['file_upload_array']['tmp_name'][$g];
$file_upload_array['type'][$g] = $_FILES['file_upload_array']['type'][$g];
$file_upload_array['error'][$g] = $_FILES['file_upload_array']['error'][$g];
}
} else {
if (is_array($_FILES['file_upload_array' . $i])) {
$file_upload_array['name'][$i] = $_FILES['file_upload_array' . $i]['name'];
$file_upload_array['size'][$i] = $_FILES['file_upload_array' . $i]['size'];
$file_upload_array['tmp_name'][$i] = $_FILES['file_upload_array' . $i]['tmp_name'];
$file_upload_array['type'][$i] = $_FILES['file_upload_array' . $i]['type'];
$file_upload_array['error'][$i] = $_FILES['file_upload_array' . $i]['error'];
} else {
$i = $iCntt;
}
}
}
}
Title: Re: Cross-platform Batch Uploading
Post by: noname00 on November 24, 2004, 03:02:57 am
this works fine for me using Mozilla 1.7.1, but not with ie 6.0.2800.1106.
windows 2000.
jupload 0.75.

in ie the applet loads fine, and i'm able to add files as usual. but when i press "upload files" they get uploaded (the progress meter works fine).
then the applet just displays the "add files" button again, and notes that a file has been uploaded (displays "Files: 1  Bytes: 7.72KB" in right-hand pane).
but it doesn't load the next page, so i can select which albums the files go in to. so the files don't get placed in any albums.

anyone know what's going on?
Title: Re: Cross-platform Batch Uploading
Post by: mhaller on November 27, 2004, 08:37:03 pm
hey guys,
i'm the developer of jupload and will try to bring some light into the problems:

- since jupload is still under development, many internal structures change between releases
- the completURL parameter does not work with realTimeResponse enabled for >0.75. just switch off with <param name="realTimeResponse" value="false"> and completeURL should work fine.
- the license problem can be discussed, i would be willing to give permission to redistribute jupload within coppermine, although i can't give out the source code (is this necessary for GPL?)

if you've got any questions, or want to request the current beta (many bugfixes and a few new, neat features like screenshot and clipboard support), just send me an email to support@jupload.biz - i try to answer every mail.

and thanks for using jupload :-)

greets
Mike
Title: Re: Cross-platform Batch Uploading
Post by: peubarge on December 12, 2004, 09:00:20 pm
Hi!
First of all, thanks for this great add-on and great applet (jupload).

After a few hours, i finally got it working. I sitill have a problem though:

When I upload 2 or 3 files with jupload, it works perfectly. When I select more files, and it takes of course more time, I get the following error in the appache error log:

[client 62.167.185.177] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in C:\\Inetpub\\wwwroot\\cpg132\\upload.php on line 21

I tried changing the value in php.ini to 3600 seconds (!) and I still get:

[client 62.167.185.177] PHP Fatal error:  Maximum execution time of 3600 seconds exceeded in C:\\Inetpub\\wwwroot\\cpg132\\upload.php on line 21

I really don't know what to do!

The server is a Windows Server 2003 with Appache 2.0.50 and php 4.3.9

I am using jupload 0.75 and cpg 1.3.2

Any idea?
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on December 13, 2004, 07:47:32 am
- the license problem can be discussed, i would be willing to give permission to redistribute jupload within coppermine, although i can't give out the source code (is this necessary for GPL?)
Packaging jupload with coppermine would be possible, but we couldn't label it as being open source under GPL, we'd have to state that part of it isn't. I think people would be shying away from the whole package if it wasn't released under GPL fully, that's why I suggest having jupload as a separate download; maybe we could ship the coppermine package (for future versions) with everything it takes to use jupload right from the start. People would then find reference to jupload in the documentation together with a link where they can get it. How does this sound to you?

Joachim
Title: Re: Cross-platform Batch Uploading
Post by: AWJunkies on January 18, 2006, 04:57:48 pm
Is this MOD still all good? Should I attempt to instal on the new 1.4.3 stable? I need users to be able to upload more then 10 files. The other copermine I had it was one at a time and it drove the members crazy. Now 10 is small step forward but we are talking about hundreds of photos that need to be uploaded at a time.  Anything higher then 10 would be awesome. Is there any other solutions out there?
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on January 21, 2006, 07:06:50 am
The thread is labelled "1.3.x", so we don't know if it will work with cpg1.4.x - why don't you try to find out and post your report here. If it works with cpg1.4.x as well, we'll re-label this thread.
Title: Re: Cross-platform Batch Uploading
Post by: AWJunkies on January 21, 2006, 08:24:48 am
Ok I will try it for sure. Just saw that is was 6 months old.
Title: Re: Cross-platform Batch Uploading
Post by: AWJunkies on January 26, 2006, 01:34:10 pm
I got all the group permission stuff to work and java applet to show. Only issue I am having is with creating the tempdata in the temptable. I am not getting any errors. The bottom status bar just keeps going accross until full and just sits there. I left it on while I went to eat and was still like that. Not sure what is causing the stall up or why it is not inserting into table. I will keep at it and get it to work. I really need this mod.
Title: Re: Cross-platform Batch Uploading
Post by: AWJunkies on January 27, 2006, 11:58:14 am
If someone could help me with this JUpload MOD to 1.4.3 Stand alone stable. Everything seems to be working but the cookie stuff. The core code is totaly different in 1.4.3.

1.3.5
functions.inc.php before JUpload MOD
Code: [Select]
function user_get_profile()
{
        global $CONFIG, $USER, $HTTP_COOKIE_VARS;

        if (isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_data'])) {
                $USER = @unserialize(@base64_decode($HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_data']));
        }

        if (!isset($USER['ID']) || strlen($USER['ID']) != 32) {
                list($usec, $sec) = explode(' ', microtime());
                $seed = (float) $sec + ((float) $usec * 100000);
                srand($seed);
                $USER=array('ID' => md5(uniqid(rand(),1)));
        } else {
                $USER['ID'] = addslashes($USER['ID']);
        }

        if (!isset($USER['am'])) $USER['am'] = 1;
}

1.3.5
functions.inc.php WITH JUpload MOD
Code: [Select]
function user_get_profile()
{
global $CONFIG, $USER, $HTTP_COOKIE_VARS;
if (isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_data'])) {
$USER = @unserialize(@base64_decode($HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_data']));
} else if (isset($_GET["cookie"])) {
//JUpload Modification Mark Stralka 7/25/2004
//if a parameter named "cookie" is passed, try to parse it into the the $USER object and
//set the cookie values.
$USER = @unserialize(@base64_decode($_GET["cookie"]));
$HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_uid'] = $USER[$CONFIG['cookie_name'].'_uid'];
$HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_data'] = $USER[$CONFIG['cookie_name'].'_data'];
$HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_pass'] = $USER[$CONFIG['cookie_name'].'_pass'];
}

if (!isset($USER['ID']) || strlen($USER['ID']) != 32) {
list($usec, $sec) = explode(' ', microtime());
$seed = (float) $sec + ((float) $usec * 100000);
srand($seed);
$USER=array('ID' => md5(uniqid(rand(),1)));
} else {
$USER['ID'] = addslashes($USER['ID']);
}

if (!isset($USER['am'])) $USER['am'] = 1;
}

1.4.3
functions.inc.php before JUpload MOD
Code: [Select]
function user_get_profile()
{
        global $CONFIG, $USER;

        if (isset($_COOKIE[$CONFIG['cookie_name'].'_data'])) {
                $USER = @unserialize(@base64_decode($_COOKIE[$CONFIG['cookie_name'].'_data']));
        }

        if (!isset($USER['ID']) || strlen($USER['ID']) != 32) {
                list($usec, $sec) = explode(' ', microtime());
                $seed = (float) $sec + ((float) $usec * 100000);
                srand($seed);
                $USER=array('ID' => md5(uniqid(rand(),1)));
        } else {
                $USER['ID'] = addslashes($USER['ID']);
        }

        if (!isset($USER['am'])) $USER['am'] = 1;
}

1.4.3
functions.inc.php WITH JUpload MOD
Code: [Select]
function user_get_profile()
{
global $CONFIG, $USER;
if (isset($_COOKIE[$CONFIG['cookie_name'].'_data'])) {
$USER = @unserialize(@base64_decode($_COOKIE[$CONFIG['cookie_name'].'_data']));
} else if (isset($_GET["cookie"])) {
//JUpload Modification Mark Stralka 7/25/2004
//if a parameter named "cookie" is passed, try to parse it into the the $USER object and
//set the cookie values.
$USER = @unserialize(@base64_decode($_GET["cookie"]));
$_COOKIE[$CONFIG['cookie_name'].'_uid'] = $USER[$CONFIG['cookie_name'].'_uid'];
$_COOKIE[$CONFIG['cookie_name'].'_data'] = $USER[$CONFIG['cookie_name'].'_data'];
$_COOKIE[$CONFIG['cookie_name'].'_pass'] = $USER[$CONFIG['cookie_name'].'_pass'];
}

if (!isset($USER['ID']) || strlen($USER['ID']) != 32) {
list($usec, $sec) = explode(' ', microtime());
$seed = (float) $sec + ((float) $usec * 100000);
srand($seed);
$USER=array('ID' => md5(uniqid(rand(),1)));
} else {
$USER['ID'] = addslashes($USER['ID']);
}

if (!isset($USER['am'])) $USER['am'] = 1;
}

Now I am not sure if I applied this right or if the $USER[$CONFIG['cookie_name'].'_uid']; and other two peramiters even work to push to cookie. Now the authentification() function is totaly different from 1.3.5 and 1.4.3 and is causing me some confusion.

1.3.5
init.inc.php
Code: [Select]
// Authenticate
if (defined('UDB_INTEGRATION')) {
    udb_authenticate();
} else {
    if (!isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_uid']) || !isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_pass'])) {
        $cookie_uid = 0;
        $cookie_pass = '*';
    } else {
        $cookie_uid = (int)$HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_uid'];
        $cookie_pass = substr(addslashes($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_pass']), 0, 32);
    }

    $sql = "SELECT * " . "FROM {$CONFIG['TABLE_USERS']} WHERE user_id='$cookie_uid'" . "AND user_active = 'YES' " . "AND user_password != '' " . "AND BINARY MD5(user_password) = '$cookie_pass'";
    $results = db_query($sql);

    if (mysql_num_rows($results)) {
        $USER_DATA = mysql_fetch_assoc($results);
        //unset($USER_DATA['user_password']);
        $USER_DATA['user_password'] = '********';

                $USER_DATA = $USER_DATA + cpgGetUserData($USER_DATA['user_group'], explode(',', $USER_DATA['user_group_list']));

        define('USER_ID', (int)$USER_DATA['user_id']);
        define('USER_NAME', $USER_DATA['user_name']);
        define('USER_GROUP', $USER_DATA['group_name']);
        define('USER_GROUP_SET', '(' . implode(',', $USER_DATA['groups']) . ')');
        define('USER_IS_ADMIN', (int)$USER_DATA['has_admin_access']);
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
        define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']);
        define('USER_UPLOAD_FORM', (int)$USER_DATA['upload_form_config']);
        define('CUSTOMIZE_UPLOAD_FORM', (int)$USER_DATA['custom_user_upload']);
        define('NUM_FILE_BOXES', (int)$USER_DATA['num_file_upload']);
        define('NUM_URI_BOXES', (int)$USER_DATA['num_URI_upload']);
        mysql_free_result($results);
    } else {
        $USER_DATA = cpgGetUserData(3, array(3));
        define('USER_ID', 0);
        define('USER_NAME', 'Anonymous');
        define('USER_GROUP', $USER_DATA['group_name']);
        define('USER_GROUP_SET', '(' . $USER_DATA['group_id'] . ')');
        define('USER_IS_ADMIN', 0);
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
        define('USER_CAN_CREATE_ALBUMS', 0);
        define('USER_UPLOAD_FORM', (int)$USER_DATA['upload_form_config']);
        define('CUSTOMIZE_UPLOAD_FORM', (int)$USER_DATA['custom_user_upload']);
        define('NUM_FILE_BOXES', (int)$USER_DATA['num_file_upload']);
        define('NUM_URI_BOXES', (int)$USER_DATA['num_URI_upload']);
        mysql_free_result($results);
    }
}

1.4.3
init.inc.php
Code: [Select]
// Authenticate
$cpg_udb->authenticate();

So now lets follow the authenticate function on the 1.4.3 and see what it is doing.

1.4.3
udb_base.inc.php
Code: [Select]
function authenticate()
{
global $USER_DATA;

if (!($auth = $this->session_extraction()) && !($auth = $this->cookie_extraction())) {
$this->load_guest_data();
} else {
list ($id, $cookie_pass) = $auth;
$f = $this->field;

if (isset($this->usergroupstable)){
$sql = "SELECT u.{$f['user_id']} AS id, u.{$f['username']} AS username, u.{$f['password']} AS password, ug.{$f['usertbl_group_id']} AS group_id ".
   "FROM {$this->usertable} AS u, {$this->usergroupstable} AS ug ".
   "WHERE u.{$f['user_id']}=ug.{$f['user_id']} AND u.{$f['user_id']}='$id'";
} else {
$sql = "SELECT u.{$f['user_id']} AS id, u.{$f['username']} AS username, u.{$f['password']} AS password, u.{$f['usertbl_group_id']}+100 AS group_id ".
   "FROM {$this->usertable} AS u INNER JOIN {$this->groupstable} AS g ON u.{$f['usertbl_group_id']}=g.{$f['grouptbl_group_id']} ".
   "WHERE u.{$f['user_id']}='$id'";
}

$result = cpg_db_query($sql, $this->link_id);

if (mysql_num_rows($result)){
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

$db_pass = $this->udb_hash_db($row['password']);
if ($db_pass === $cookie_pass) {
$this->load_user_data($row);
} else {
$this->load_guest_data();
}
} else {
$this->load_guest_data();
}
}

$user_group_set = '(' . implode(',', $USER_DATA['groups']) . ')';

        $USER_DATA = array_merge($USER_DATA, $this->get_user_data($USER_DATA['groups'][0], $USER_DATA['groups'], $this->guestgroup));

if ($this->use_post_based_groups){
$USER_DATA['has_admin_access'] = (in_array($USER_DATA['groups'][0] - 100,$this->admingroups)) ? 1 : 0;
} else {
$USER_DATA['has_admin_access'] = ($USER_DATA['groups'][0] == 1) ? 1 : 0;
}

$USER_DATA['can_see_all_albums'] = $USER_DATA['has_admin_access'];

// avoids a template error
if (!$USER_DATA['user_id']) $USER_DATA['can_create_albums'] = 0;

    // For error checking
$CONFIG['TABLE_USERS'] = '**ERROR**';

define('USER_ID', $USER_DATA['user_id']);
        define('USER_NAME', addslashes($USER_DATA['user_name']));
        define('USER_GROUP', $USER_DATA['group_name']);
        define('USER_GROUP_SET', $user_group_set);
        define('USER_IS_ADMIN', $USER_DATA['has_admin_access']);
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
        define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']);
        define('USER_UPLOAD_FORM', (int)$USER_DATA['upload_form_config']);
        define('CUSTOMIZE_UPLOAD_FORM', (int)$USER_DATA['custom_user_upload']);
        define('NUM_FILE_BOXES', (int)$USER_DATA['num_file_upload']);
        define('NUM_URI_BOXES', (int)$USER_DATA['num_URI_upload']);

$this->session_update();
}

So everything changed. Now I have no idea what is going on right here" list ($id, $cookie_pass) = $auth; " . So basicaly I need to know how to apply the idea of what they where doing here:
 
Code: [Select]
} else if (isset($_GET["cookie"])) {
//JUpload Modification Mark Stralka 7/25/2004
//if a parameter named "cookie" is passed, try to parse it into the the $USER object and
//set the cookie values.
$USER = @unserialize(@base64_decode($_GET["cookie"]));
$HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_uid'] = $USER[$CONFIG['cookie_name'].'_uid'];
$HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_data'] = $USER[$CONFIG['cookie_name'].'_data'];
$HTTP_COOKIE_VARS[$CONFIG['cookie_name'].'_pass'] = $USER[$CONFIG['cookie_name'].'_pass'];
to the 1.4.3.

If anyone can help me in this it would be much appreciated.
Title: Re: Cross-platform Batch Uploading
Post by: Joachim Müller on January 30, 2006, 12:02:20 am
split the topic that deals with this mod for cpg1.4.x into a separate thread: Cross-platform Batch Uploading (cpg1.4.x) (http://forum.coppermine-gallery.net/index.php?topic=27138.0)