[Solved]: Support for Formats Upload Modification [Solved]: Support for Formats Upload Modification
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Solved]: Support for Formats Upload Modification

Started by Garibaldi, July 24, 2009, 06:30:43 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Garibaldi

This thread is for support of the Formats Upload Modification. Please post your questions here and I'll do my best to answer them.

First, I have a question 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
$extension = "zip";
Replace this with the extension of your choice.

2. open /formats_upload.php and find
file_types : "*.zip",
Replace with your filetype, e.g.
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!

phill104

It is a mistake to think you can solve any major problems just with potatoes.

Garibaldi

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

mushipkw

I found out how to enable multiple extensions
in formats_upload.php
file_types : "*.zip;*.rar;",

Add files types separated by a semicolon ;

Garibaldi


mushipkw

Although by editing
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.

mushipkw

Found the solution to this too
Open formats_helper.php
find
$extension_whitelist = array("jpg", "gif", "png", "zip"); // Allowed file extensions

and add extensions separated by comma

Garibaldi

Thanks for helping me solve this request. I'm glad you got it! :)

mushipkw

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.

Garibaldi

There is an update available that adds this feature. Please see this post for upgrade instructions.

SpectroPro

Quote from: Garibaldi on July 24, 2009, 06:30:43 PM
This thread is for support of the Formats Upload Modification. Please post your questions here and I'll do my best to answer them.

First, I have a question 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
$extension = "zip";
Replace this with the extension of your choice.

2. open /formats_upload.php and find
file_types : "*.zip",
Replace with your filetype, e.g.
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

Garibaldi

Hi Greg,

Unfortunately, that code would not work. What I believe you could do is try this instead (untested):

$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

SpectroPro

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


SpectroPro

Quote from: Joachim Müller on September 14, 2009, 03:34:54 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

Garibaldi

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:
var filename = str_replace(" ", "%20", document.getElementById("fileNAME").value);

After, add:
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:
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:
}