Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gift Cards Cannot Set Image #2258

Closed
bhsmither opened this issue Mar 9, 2019 · 0 comments
Closed

Gift Cards Cannot Set Image #2258

bhsmither opened this issue Mar 9, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@bhsmither
Copy link
Contributor

CC622 and probably later.

Selecting an image to assign to a Gift Card fails to be processed on POST.

In settings.giftcerts.php, there is:

<input name="image" id="uploader" type="file">

A POST with a type="file" will cause PHP to create the superglobal $_FILES.

If no actual image is in the POST payload, the resulting array is:

$_FILES => Array
(
    [image] => Array
        (
            [name] => 
            [type] => 
            [tmp_name] => 
            [error] => 4  // UPLOAD_ERR_NO_FILE
            [size] => 0
        )

In settings.giftcertificates.inc.php, near line 21, a call is made to FileManager->upload(). Then, FileManager->upload() tests for a non-empty $_FILES - which evaluates to true and finally returns true.

PHP complains about the argument in the following foreach().

Suggest similar to categories.index.inc.php:

if (($uploaded = $filemanager->upload()) !== false && is_array($uploaded)) {

Also, the File Picker javascript does not switch to the 1.jpg for the assigned image.

Also, the image preview does not work.

@abrookbanks abrookbanks self-assigned this Aug 13, 2019
@abrookbanks abrookbanks added this to the 6.2.6 milestone Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants