WeBid Bug Tracking

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000018WeBidGallerypublic2009-05-21 11:112009-06-26 15:08
ReporterMike 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version0.7.3 / 0.7.4 
Target VersionFixed in Version0.8.0 
Summary0000018: Picture upload problem
DescriptionOk chances are that this is something I have done, however when uploading a picture of an item, it never seems to work if the extension is in uppercase. For the same picture if I give it a lowercase extension(from .JPG to .jpg) then it works fine.



I have had a quick look through the upload script and there seems to be an strtolower command in there.



So I checked the uploaded directory and the picture is in the temp directory with a name something like: IMAGE_JPG.jpg

If I upload in lowercase, it just shows as IMAGE.jpg and all works



Is this something I have done or is it a known problem?



Thanks!
TagsNo tags attached.
import_id18
Thread
Attached Files

- Relationships

-  Notes
(0000071)
renlok (administrator)
2009-05-21 12:44
edited on: 1970-01-01 00:00

oh i had not noticed that before, yes its a genuine bug to fix it change
[php] $filename = basename($_FILES['userfile']['name']);
        $nameparts = explode('.', $filename);
        $file_ext = strtolower($nameparts[count($nameparts) - 1]);[/php]
to
[php] $filename = strtolower($_FILES['userfile']['name']);
        $nameparts = explode('.', $filename);
        $file_ext = $nameparts[count($nameparts) - 1];[/php]

change
[php]$newname = str_replace('.gif', '', $_FILES['userfile']['name']);[/php]
to
[php]$newname = str_replace('.gif', '', $filename);[/php]

change
[php]$newname = str_replace('.jpg', '', $_FILES['userfile']['name']);[/php]
to
[php]$newname = str_replace('.jpg', '', $filename);[/php]

change
[php]$newname = str_replace('.jpeg', '', $_FILES['userfile']['name']);[/php]
to
[php]$newname = str_replace('.jpeg', '', $filename);[/php]

change
[php]$newname = str_replace('.png', '', $_FILES['userfile']['name']);[/php]
to
[php]$newname = str_replace('.png', '', $filename);[/php]
(0000072)
Mike (reporter)
2009-05-21 13:05
edited on: 1970-01-01 00:00

Thanks for the quick reply, I have made the changes, cleared the cache, but it still doesn't seem to work.

Do I need to clear any other settings or do anything else?
(0000073)
renlok (administrator)
2009-05-21 14:03
edited on: 1970-01-01 00:00

wel i was hoping it work when you next uploaded a file, but ill do some more tests see if can get it working
(0000074)
Mike (reporter)
2009-05-21 14:13
edited on: 1970-01-01 00:00

Do you want access to my site so you can see?

Or are you able to re-create the problem somewhere else?
(0000075)
Box Lot (reporter)
2009-05-21 14:46
edited on: 2009-05-21 14:52

I was always led to believe, for many years and from different sources, that regardless of the site that you should always use lower case for the suffix of uploaded files.

On the server I'm working with images will not show unless suffix is lower case and not just with WeBid (which I haven't tested per. se. since I always use lower case suffix anyway).

Can't recall but might just be with certain server configurations but always the case with servers that I've used.
(0000077)
Mike (reporter)
2009-05-22 09:07
edited on: 1970-01-01 00:00

Box Lot: Yes that's probably true, but with an auction site you get all sorts on non-computer literate people uploading photos straight from their cameras, usually the picture names are all in uppercase.

With my site here on the Costa Blanca, the average age of people using it will probably be about 60, it needs to be as simple as possible.
(0000078)
renlok (administrator)
2009-05-22 12:50
edited on: 2009-05-22 12:52

Just to let you know my computer finally died on me so i wont be able to find a fix for this for a while.

I think it may be quite an important fix tbh as i know some old programs people may use to resize image such as paint save with CAPITAL extension names
(0000079)
Box Lot (reporter)
2009-05-22 15:56
edited on: 1970-01-01 00:00

Certainly a good idea if you can correct capital uploads in the system, I was trying to explain what was happening based on your initial question since it didn't appear that you knew why it was happening.

Worst case a note can be placed on the pages that allow user uploads.
(0000080)
cashew (viewer)
2009-05-25 20:04
edited on: 1970-01-01 00:00

Hi! For your information, on my site running Webid ALL my pictures are upper case name including ext and they upload well
(0000082)
renlok (administrator)
2009-05-28 20:22
edited on: 1970-01-01 00:00

yeah i think this another server dependant bug which are always annoying.
(0000085)
dannywiz (viewer)
2009-05-31 14:02
edited on: 1970-01-01 00:00

There is a logical bug in the image upload php code, because the image filename could not be changed, or the image won't be correctly managed.

Actually the filename will be changed by that code when it contains a space, or a dot, or a comma, or an uppercase extension; in any of these cases the filename will be changed and the image won't appear. You should rename the image files BEFORE to upload them.

To solve this bug, edit upldgallery.php and change these rows:

[PHP]array_push($_SESSION['UPLOADED_PICTURES'], $_FILES['userfile']['name']);
$fname = $upload_path . session_id() . '/' . $_FILES['userfile']['name'];
array_push($_SESSION['UPLOADED_PICTURES_SIZE'], filesize($fname));
if (count($_SESSION['UPLOADED_PICTURES']) == 1) {
    $cropdefault = true;
    $image = $_FILES['userfile']['name'];
}[/PHP]

as follows:

[PHP]array_push($_SESSION['UPLOADED_PICTURES'], $newname);
$fname = $upload_path . session_id() . '/' . $newname;
array_push($_SESSION['UPLOADED_PICTURES_SIZE'], filesize($fname));
if (count($_SESSION['UPLOADED_PICTURES']) == 1) {
    $cropdefault = true;
    $image = $newname;
}[/PHP]
(0000118)
renlok (administrator)
2009-06-25 19:28
edited on: 1970-01-01 00:00

could someone who can reproduce this error test my fix at http://www.webidsupport.com/forums/showpost.php?p=4756[/url] [^]
(0000119)
Mike (reporter)
2009-06-25 20:31
edited on: 1970-01-01 00:00

renlok wrote

could someone who can reproduce this error test my fix at http://www.webidsupport.com/forums/showpost.php?p=4756[/url][/quote] [^]

I switched to this file and it threw out an error because it was looking for common.php which I don't have, I set it to config.php and then it only ever showed me the login screen.

I do have another question to do with this though.

        
Someone wrote

if($system->move_file($_FILES['userfile']['tmp_name'], $upload_path . session_id() . '/' . $newname)) {
                // Populate arrays
                array_push($_SESSION['UPLOADED_PICTURES'], $newname);
                $fname = $upload_path . session_id() . '/' . $newname;
                array_push($_SESSION['UPLOADED_PICTURES_SIZE'], filesize($fname));
                if (count($_SESSION['UPLOADED_PICTURES']) == 1) {
                    $cropdefault = true;
                    $image = $newname;
                }
            }


In the above code, I set $cropdefault to false, and it sckipped the thumbnail screen. Will that now just automatically use a squashed version of the picture?
(0000120)
renlok (administrator)
2009-06-25 20:45
edited on: 1970-01-01 00:00

oops i forgot about that, i made some updates to the user control since 0.7.4
change
[php]include 'includes/common.inc.php';

if (!$user->logged_in)
{
    //if your not logged in you shouldn't be here
    header("location: user_login.php");
    exit;
}[/php]
to
[php]include 'includes/config.inc.php';[/php]

and yes it will
(0000121)
Mike (reporter)
2009-06-25 21:29
edited on: 1970-01-01 00:00

Did you already change that section in the file you linked to? because it starts like this:

Someone wrote

include 'includes/config.inc.php';
$cropdefault = false;
$width = $system->SETTINGS['thumb_show'];
$height = $width / 1.2;


Either way it seemed to work fine with uppercase and lowercase extensions.
(0000122)
renlok (administrator)
2009-06-25 22:07
edited on: 1970-01-01 00:00

yeah i reuploaded it with the fix and awesome thats another bug fixed :)
(0000123)
Mike (reporter)
2009-06-26 09:15
edited on: 1970-01-01 00:00

Good job matey, you are very efficient!
(0000124)
Box Lot (reporter)
2009-06-26 15:08
edited on: 1970-01-01 00:00

Same initial errors but couldn't get back fast enough to beat Mike!

Just extra confirmation, tested new upload on my end with spaces in image name as well as all caps for suffix and now working.

- Issue History
Date Modified Username Field Change
2015-04-01 13:17 renlok New Issue
2015-04-01 13:17 renlok import_id => 18
2015-04-01 13:17 renlok Date Submitted 2015-04-01 13:17 => 2009-05-21 11:11
2015-04-01 13:17 renlok Last Update 2015-04-01 13:17 => 2009-06-26 15:08


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker