Can't upload pics with "~" Can't upload pics with "~"
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Can't upload pics with "~"

Started by FansCityEu, September 28, 2014, 01:34:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

FansCityEu

Hi,
I'm trying to upload a picture with batch with this name: 01~242.jpg and it gives me this error (I'm translating it from Spanish so it's similar): "Only files with the following extensions are accepted" and it includes .jpg, if I remove the ~ it works but if not it gave me that error. I have downloaded and uploaded (on ftp) to many pictures to change each one.. :/ What Can I do?

ron4mac

Update you Coppermine installation to the latest version.

FansCityEu

Hi,
I have the latest: 1.5.30
Quote from: ron4mac on September 28, 2014, 02:18:28 PM
Update you Coppermine installation to the latest version.

ron4mac

I've tried to replicate your problem but on my installation of 1.5.30 it functions without any error.

FansCityEu

I think it's something related with the server or maybe because I'm using GD instead of Imagemagick :/ I don't know but I hate it.
Quote from: ron4mac on September 28, 2014, 05:41:13 PM
I've tried to replicate your problem but on my installation of 1.5.30 it functions without any error.

ron4mac

Hold on ... I've been able to replicate your issue.  Give me a few hours to come up with a solution for you.

FansCityEu

Thank you so much!
Quote from: ron4mac on September 28, 2014, 06:16:43 PM
Hold on ... I've been able to replicate your issue.  Give me a few hours to come up with a solution for you.

ron4mac

Sorry I couldn't get to this sooner ...

This interim patch for the issue you are experiencing is not official.

In the file searchnew.php at about line #106 change:
    $encoded_picfile = base64_encode($picfile);
to:
    $encoded_picfile = urlencode(base64_encode($picfile));

And in the file showthumb.php at about line #141 change:
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z\/\\\\_.-\s]+$/');
to: (add a tilde [~] after the lowercase z)
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~\/\\\\_.-\s]+$/');


Anything official involving this would be pending whether ~'s are to be acceptably allowed in file names.

Αndré

I don't see a reason to disallow the tilde, as it's also used for the HTTP upload forms:
Code (db_input.php) Select
    while (file_exists($dest_dir . $picture_name)) {
        $picture_name = $matches[1] . '~' . $nr++ . '.' . $matches[2];
    }


I'll have a closer look at your patch and add it to our SVN repository, if applicable.

FansCityEu

It worked! Thank you so much :D
Quote from: ron4mac on September 29, 2014, 12:33:05 AM
Sorry I couldn't get to this sooner ...

This interim patch for the issue you are experiencing is not official.

In the file searchnew.php at about line #106 change:
    $encoded_picfile = base64_encode($picfile);
to:
    $encoded_picfile = urlencode(base64_encode($picfile));

And in the file showthumb.php at about line #141 change:
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z\/\\\\_.-\s]+$/');
to: (add a tilde [~] after the lowercase z)
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~\/\\\\_.-\s]+$/');


Anything official involving this would be pending whether ~'s are to be acceptably allowed in file names.

Αndré

Those changes have been committed in SVN revision 8741 and will be part of cpg1.5.32 and later.