Advanced search  

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]

Pages: [1]   Go Down

Author Topic: [Solved]: Support for Formats Upload Modification  (Read 6936 times)

0 Members and 1 Guest are viewing this topic.

Garibaldi

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • Wisconsin Collector Car
[Solved]: Support for Formats Upload Modification
« 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
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!
« Last Edit: July 29, 2009, 07:12:42 am by Joachim Müller »
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4822
    • Windsurf.me
Re: Support for Formats Upload Modification
« Reply #1 on: July 24, 2009, 07:40:41 pm »

I think you will find the Filetypes Plugin easier
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Garibaldi

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • Wisconsin Collector Car
Re: Support for Formats Upload Modification
« Reply #2 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
Logged

mushipkw

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: Support for Formats Upload Modification
« Reply #3 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 ;
Logged

Garibaldi

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • Wisconsin Collector Car
Re: Support for Formats Upload Modification
« Reply #4 on: July 25, 2009, 09:06:31 pm »

Great! Glad to hear you got it!
Logged

mushipkw

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: Support for Formats Upload Modification
« Reply #5 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.
Logged

mushipkw

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: Support for Formats Upload Modification
« Reply #6 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
Logged

Garibaldi

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • Wisconsin Collector Car
Re: Support for Formats Upload Modification
« Reply #7 on: July 29, 2009, 07:03:55 am »

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

mushipkw

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: [Solved]: Support for Formats Upload Modification
« Reply #8 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.
Logged

Garibaldi

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • Wisconsin Collector Car
Re: [Solved]: Support for Formats Upload Modification
« Reply #9 on: August 07, 2009, 08:11:22 pm »

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

SpectroPro

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • Bluestream Airlines - Virtual
Re: [Solved]: Support for Formats Upload Modification
« Reply #10 on: September 06, 2009, 08:36:41 am »

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
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
Logged

Garibaldi

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • Wisconsin Collector Car
Re: [Solved]: Support for Formats Upload Modification
« Reply #11 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
Logged

SpectroPro

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • Bluestream Airlines - Virtual
Re: [Solved]: Support for Formats Upload Modification
« Reply #12 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged

SpectroPro

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • Bluestream Airlines - Virtual
Re: [Solved]: Support for Formats Upload Modification
« Reply #14 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
Logged

Garibaldi

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • Wisconsin Collector Car
Re: [Solved]: Support for Formats Upload Modification
« Reply #15 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]
}
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 19 queries.