forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Garibaldi on July 24, 2009, 06:30:43 pm

Title: [Solved]: Support for Formats Upload Modification
Post by: Garibaldi on July 24, 2009, 06:30:43 pm
This thread is for support of the Formats Upload Modification (http://forum.coppermine-gallery.net/index.php/topic,59073.0.html). Please post your questions here and I'll do my best to answer them.

First, I have a question (http://forum.coppermine-gallery.net/index.php/topic,59073.msg301098.html#msg301098) mushipkw about how to upload other formats besides .zip like .rar. To do this, I believe you just have to
1. open /include/picmgmt.inc.php and find
Code: [Select]
$extension = "zip";Replace this with the extension of your choice.

2. open /formats_upload.php and find
Code: [Select]
file_types : "*.zip",Replace with your filetype, e.g.
Code: [Select]
file_types : "*.rar",I believe you can also add multiple filetypes, like "*.zip,*.rar", but I am not intimately familiar with the SWFUpload script so try it out and see.

Good luck!
Title: Re: Support for Formats Upload Modification
Post by: phill104 on July 24, 2009, 07:40:41 pm
I think you will find the Filetypes Plugin  (http://forum.coppermine-gallery.net/index.php/topic,24186.0.html) easier
Title: Re: Support for Formats Upload Modification
Post by: Garibaldi on July 24, 2009, 08:07:23 pm
The additional filetypes that this user requested is part of this modification which does not use the Coppermine database but rather a separate program (called SWFUpload) for uploading this .zip or whatever file. The URL to that file is then placed in the Custom User Field 1 for the image so unless I'm mistaken, using the Filetypes Plugin won't work since it cannot adjust the types of files that SWFUpload will allow
Title: Re: Support for Formats Upload Modification
Post by: mushipkw on July 25, 2009, 05:34:02 pm
I found out how to enable multiple extensions
in formats_upload.php
Code: [Select]
file_types : "*.zip;*.rar;",
Add files types separated by a semicolon ;
Title: Re: Support for Formats Upload Modification
Post by: Garibaldi on July 25, 2009, 09:06:31 pm
Great! Glad to hear you got it!
Title: Re: Support for Formats Upload Modification
Post by: mushipkw on July 27, 2009, 10:55:00 am
Although by editing
Code: [Select]
file_types : "*.zip;*.rar;",
the upload window shows the supported file types and loading bar completes. After clicking done, The file doesn't gets uploaded although zip files are successfully uploading.
Title: Re: Support for Formats Upload Modification
Post by: mushipkw on July 27, 2009, 11:38:15 am
Found the solution to this too
Open formats_helper.php
find
Code: [Select]
$extension_whitelist = array("jpg", "gif", "png", "zip"); // Allowed file extensions
and add extensions separated by comma
Title: Re: Support for Formats Upload Modification
Post by: Garibaldi on July 29, 2009, 07:03:55 am
Thanks for helping me solve this request. I'm glad you got it! :)
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: mushipkw on August 07, 2009, 07:52:01 pm
How can I delete the file associated file uploaded with the image when deleting the image, when I delete the image the associate file still exists on the server.
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: Garibaldi on August 07, 2009, 08:11:22 pm
There is an update available that adds this feature. Please see this post (http://forum.coppermine-gallery.net/index.php/topic,59073.msg301940.html#msg301940) for upgrade instructions.
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: SpectroPro on September 06, 2009, 08:36:41 am
This thread is for support of the Formats Upload Modification (http://forum.coppermine-gallery.net/index.php/topic,59073.0.html). Please post your questions here and I'll do my best to answer them.

First, I have a question (http://forum.coppermine-gallery.net/index.php/topic,59073.msg301098.html#msg301098) mushipkw about how to upload other formats besides .zip like .rar. To do this, I believe you just have to
1. open /include/picmgmt.inc.php and find
Code: [Select]
$extension = "zip";Replace this with the extension of your choice.

2. open /formats_upload.php and find
Code: [Select]
file_types : "*.zip",Replace with your filetype, e.g.
Code: [Select]
file_types : "*.rar",I believe you can also add multiple filetypes, like "*.zip,*.rar", but I am not intimately familiar with the SWFUpload script so try it out and see.

Good luck!

Would the picmgnt.inc.php file code look like this:     $extension = "zip", "rar";
???

- Greg
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: Garibaldi on September 08, 2009, 04:45:41 am
Hi Greg,

Unfortunately, that code would not work. What I believe you could do is try this instead (untested):
Code: [Select]
$extension = array("zip", "rar");
// ******************** //
// **** END CONFIG **** //
// ******************** //

        foreach ($extension as $key => $value) {
              $user1_file = substr($filename, 0, strlen($filename)-3) . $value;
        // check to see if user1 not set already and exists in the specified dir
        if(($user1 == '') && is_file($user1_path . $user1_file)) {
$user1 = $user1_url . $user1_file;
        }
        }

That should iterate over the specified extensions and then set the user1 value to the file that exists
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: SpectroPro on September 08, 2009, 12:28:25 pm
That works..  thanks!

Ready for another one?  LOL 

Ok..you upload a pic.  Then, you upload a file.  Then, for giggles, you upload another file (same pic..you just choose to upload another one)..it uploads...and the file you can d/l now changes to the second one.  Ok..apparently what you wanted.  however, when you delete, it will only delete the second file. 

Seems this could go 2 ways:

1)  If they upload a new file, add a new file to download link.  So if they up 2 files, there would be 2 file links.
2)  Ask if they are replacing the file.  If so, then delete the first automatically FIRST, then allow the upload of the second. 

Or, if you don't want to do any of these...at least lock the button so that once a file has been uploaded, another file can NOT be uploaded (that is a really bad choice of the 3 options....)

Oh..sorry for posting 2 in one post...  Can you make it so that File info is ON by default?  Is that a setting option that I have missed?   By using your mod here as some of us are using it...  seems that having file info closed by default (thus you don't see the download file) is defeating using this.  We obviously want them to see they can download that file.  As for me, that's the entire reason I am using this and coppermin to begin with.

Thanks!!!!

- Greg
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: Joachim Müller on September 14, 2009, 03:34:54 pm
Oh..sorry for posting 2 in one post... 
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270618.html#msg270618
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: SpectroPro on September 14, 2009, 03:47:55 pm
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270618.html#msg270618

It's all for the the same add-on...but ok... here it is all by itself:

Can you make it so that File info is ON by default?  Is that a setting option that I have missed?   By using your mod here as some of us are using it...  seems that having file info closed by default (thus you don't see the download file) is defeating using this.  We obviously want them to see they can download that file.  As for me, that's the entire reason I am using this and coppermine to begin with.

- Greg
Title: Re: [Solved]: Support for Formats Upload Modification
Post by: Garibaldi on September 15, 2009, 05:18:09 am
Hi Greg,

I believe having the file info on under immediate images is either a setting in the Coppermine Config or there is a modification you can install. I believe the mod lets you adjust specifically which items in the file info appear.

As far as having a second associated file and deleting the first, this is difficult to do because the field is changed from a Javascript call. Since Javascript is running in your browser on the client side, it cannot check if the file exists on the server. Would it be possible to instead alert the user that they should reupload the image when they try to upload a second associated file? To do that, I believe this would work:

In formats_upload.php, find:
Code: [Select]
var filename = str_replace(" ", "%20", document.getElementById("fileNAME").value);
After, add:
Code: [Select]
if (window.opener.document.getElementById(window.name).value != "") {
    alert("You must delete this image and then upload it again to add a different associated file");
} else {

Find:
Code: [Select]
window.opener.document.getElementById(window.name).value = upload_url + substr(filename, 0, strlen(filename)-4) + document.getElementById("rand").value + substr(filename, strlen(filename)-4);
close();

After, add:
Code: [Select]
}