[opencms-dev] About problem Upload image in wrong folder when editing content in OpenCms 8.5.2

Deiverson Silveira deiverson at solutioncms.com
Tue Aug 13 15:51:00 CEST 2013


I'm debug this code, I belive this problem is here:

Class: org.opencms.ade.upload. CmsUploadBean

Method:



    /**

     * Returns the target folder for the new resource,

     * if the given folder does not exist root folder

     * of the current site is returned.<p>

     *

     * *@param* cms the CMS context to use

     *

     * *@return* the target folder for the new resource

     *

     * *@throws* CmsException if something goes wrong

     */

    *private* String getTargetFolder(CmsObject cms) *throws* CmsException {



        // get the target folder on the *vfs*

        CmsResource target = cms.readResource("/", CmsResourceFilter.*
IGNORE_EXPIRATION*);

        *if* (m_parameterMap.get(I_CmsUploadConstants.*
UPLOAD_TARGET_FOLDER_FIELD_NAME*) != *null*) {

            String targetFolder = m_parameterMap.get(I_CmsUploadConstants.*
UPLOAD_TARGET_FOLDER_FIELD_NAME*)[0];

            *if* (CmsStringUtil.*isNotEmptyOrWhitespaceOnly*(targetFolder))
{

               *if* (cms.existsResource(targetFolder)) {

                    CmsResource tmpTarget = cms.readResource(targetFolder,
CmsResourceFilter.*IGNORE_EXPIRATION*);

                    *if* (tmpTarget.isFolder()) {

                        target = tmpTarget;

                    }

                }

            }

        }

//targetFolder is the problem

        String targetFolder =
cms.getRequestContext().removeSiteRoot(target.getRootPath());

        *if* (!targetFolder.endsWith("/")) {

            // add folder separator to currentFolder

            targetFolder += "/";

        }

        *return* targetFolder;

    }

2013/8/8 Deiverson Silveira <deiverson at solutioncms.com>

> Hi Marc,
>
> I dont understand why the project demo its works upload in folder, and why
> when I put in my project, it does not upload to the folder correct
> gallery... send to root...
>
> Hi, Tobias, you can help us?
>
> Regards,
>
> DEiverson
>
> 2013/8/8 Marc Johnen <opencms at johnen.biz>
>
>> I think it doesn't work anymore:
>>
>> https://github.com/alkacon/opencms-core/issues/178
>>
>>
>>
>> -----
>> Greetings
>> Marc Johnen
>> http://www.johnen.biz
>> --
>> View this message in context:
>> http://opencms.996256.n3.nabble.com/About-problem-Upload-image-in-wrong-folder-when-editing-content-in-OpenCms-8-5-2-tp23528p23531.html
>> Sent from the OpenCMS mailing list archive at Nabble.com.
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>
>>
>>
>>
>
>
> --
> *
> www.solutioncms.com
>  The Brazilian
> Official Provider OpenCms
> *
>



-- 
*
www.solutioncms.com
The Brazilian
Official Provider OpenCms
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130813/cab7de7f/attachment.htm>


More information about the opencms-dev mailing list