I'm debug this code, I belive this problem is here:<div><p class="MsoNormal"><span style="color:#1f497d">Class:
org.opencms.ade.upload.</span> <span style="color:#1f497d">CmsUploadBean </span></p>

<p class="MsoNormal"><span style="color:#1f497d">Method:</span></p>

<p class="MsoNormal"><span style="color:#1f497d"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">    </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">/**</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * Returns the target folder for the new
resource, </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * if the given folder does not exist root
folder</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * of the current site is returned.</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f7f9f"><p></span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f9fbf">@param</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf"> cms the CMS context to use </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f9fbf">@return</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf"> the target folder for the new
resource</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     * </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f9fbf">@throws</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf"> CmsException if something goes
wrong</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f5fbf">     */</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">    </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">private</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas"> String getTargetFolder(CmsObject cms) </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">throws</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas"> CmsException {</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">        </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f7f5f">// get the target folder on the <u>vfs</u></span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas;background-color:silver;background-repeat:initial initial">       
CmsResource target = cms.readResource(</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#2a00ff;background:silver">"/"</span><span lang="EN-US" style="font-size:10pt;font-family:Consolas;background-color:silver;background-repeat:initial initial">, CmsResourceFilter.</span><i><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0000c0;background:silver">IGNORE_EXPIRATION</span></i><span lang="EN-US" style="font-size:10pt;font-family:Consolas;background-color:silver;background-repeat:initial initial">);</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">        </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">if</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas"> (</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0000c0;background:silver">m_parameterMap</span><span lang="EN-US" style="font-size:10pt;font-family:Consolas">.get(I_CmsUploadConstants.</span><i><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0000c0">UPLOAD_TARGET_FOLDER_FIELD_NAME</span></i><span lang="EN-US" style="font-size:10pt;font-family:Consolas">) != </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">null</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas">) {</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">           
String targetFolder = </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0000c0;background:silver">m_parameterMap</span><span lang="EN-US" style="font-size:10pt;font-family:Consolas">.get(I_CmsUploadConstants.</span><i><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0000c0">UPLOAD_TARGET_FOLDER_FIELD_NAME</span></i><span lang="EN-US" style="font-size:10pt;font-family:Consolas">)[0];</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">            </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">if</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas"> (CmsStringUtil.<i>isNotEmptyOrWhitespaceOnly</i>(targetFolder))
{</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">               </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">if</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas">
(cms.existsResource(targetFolder)) {</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">                   
CmsResource tmpTarget = cms.readResource(targetFolder, CmsResourceFilter.</span><i><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#0000c0">IGNORE_EXPIRATION</span></i><span lang="EN-US" style="font-size:10pt;font-family:Consolas">);</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">                   
</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">if</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas"> (tmpTarget.isFolder()) {</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">                       
target = tmpTarget;</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">                   
}</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">               
}</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">            }</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">        }</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p><p class="MsoNormal"><font face="Consolas">//targetFolder is the problem</font></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">        String targetFolder =
cms.getRequestContext().removeSiteRoot(target.getRootPath());</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">        </span><b><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#7f0055">if</span></b><span lang="EN-US" style="font-size:10pt;font-family:Consolas"> (!targetFolder.endsWith(</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#2a00ff">"/"</span><span lang="EN-US" style="font-size:10pt;font-family:Consolas">)) {</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">            </span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas;color:#3f7f5f">// add folder separator to currentFolder</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span lang="EN-US" style="font-size:10pt;font-family:Consolas">            </span><span style="font-size:10pt;font-family:Consolas">targetFolder += </span><span style="font-size:10.0pt;font-family:Consolas;color:#2a00ff">"/"</span><span style="font-size:10pt;font-family:Consolas">;</span><span style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">        }</span><span style="font-size:10.0pt;font-family:Consolas"></span></p>

<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">        </span><b><span style="font-size:10.0pt;font-family:Consolas;color:#7f0055">return</span></b><span style="font-size:10pt;font-family:Consolas"> targetFolder;</span><span style="font-size:10.0pt;font-family:Consolas"></span></p>


<p class="MsoNormal"><span style="font-size:10pt;font-family:Consolas">    }</span><span style="color:#1f497d"></span></p><br><div class="gmail_quote">2013/8/8 Deiverson Silveira <span dir="ltr"><<a href="mailto:deiverson@solutioncms.com" target="_blank">deiverson@solutioncms.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Marc,<div><br></div><div>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...</div>
<div><br></div><div>
Hi, Tobias, you can help us?</div><div><br></div><div>Regards,</div><div><br></div><div>DEiverson</div><div><div><div class="h5"><br><div class="gmail_quote">2013/8/8 Marc Johnen <span dir="ltr"><<a href="mailto:opencms@johnen.biz" target="_blank">opencms@johnen.biz</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think it doesn't work anymore:<br>
<br>
<a href="https://github.com/alkacon/opencms-core/issues/178" target="_blank">https://github.com/alkacon/opencms-core/issues/178</a><br>
<br>
<br>
<br>
-----<br>
Greetings<br>
Marc Johnen<br>
<a href="http://www.johnen.biz" target="_blank">http://www.johnen.biz</a><br>
--<br>
View this message in context: <a href="http://opencms.996256.n3.nabble.com/About-problem-Upload-image-in-wrong-folder-when-editing-content-in-OpenCms-8-5-2-tp23528p23531.html" target="_blank">http://opencms.996256.n3.nabble.com/About-problem-Upload-image-in-wrong-folder-when-editing-content-in-OpenCms-8-5-2-tp23528p23531.html</a><br>


Sent from the OpenCMS mailing list archive at Nabble.com.<br>
_______________________________________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev</a><br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><div class="im">-- <br><i><div><span style="font-style:normal"><i><div><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><a href="http://www.solutioncms.com" target="_blank">www.solutioncms.com</a></i></span></div>

</i></span></div><div><span style="font-style:normal"><i><span style="font-style:normal"><i><div><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><span style="font-style:normal"><i><div style="display:inline!important">

<i>The Brazilian </i><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><span style="font-style:normal"><i><div style="display:inline!important"><i>Official Provider OpenCms</i></div>

</i></span></i></span></div></i></span></div></i></span></i></span></div></i></span></div></i></span></i></span></div></i></span></div></i>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><i><div><span style="font-style:normal"><i><div><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><a href="http://www.solutioncms.com" target="_blank">www.solutioncms.com</a></i></span></div>
</i></span></div><div><span style="font-style:normal"><i><span style="font-style:normal"><i><div><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><span style="font-style:normal"><i><div style="display:inline!important">
<i>The Brazilian </i><span style="font-style:normal"><i><div style="display:inline!important"><span style="font-style:normal"><i><span style="font-style:normal"><i><div style="display:inline!important"><i>Official Provider OpenCms</i></div>
</i></span></i></span></div></i></span></div></i></span></i></span></div></i></span></div></i></span></i></span></div></i></span></div></i>
</div>