Message Boards

Back

Drag and Drop Not Working

Toggle
Drag and Drop Not Working
drag drop
Answer
7/8/21 3:08 AM
I'm having trouble trying to Drag and Drop using the File component

If it works when selecting from Explorer.

Has anyone had similar problems?
0 (0 Votes)

RE: Drag and Drop Not Working
Answer
7/8/21 3:20 AM as a reply to Imagineer Customer Experience.
Hello,

Which version of Liferay do you use? 

Regards,
Sabri BEN SALEM
0 (0 Votes)

RE: Drag and Drop Not Working
drag drop
Answer
7/8/21 11:20 AM as a reply to sabri ben salem.
Hello! 

I'm using liferay 7.1.3 GA4 and for Advance File Input is using version 1.0

  • hs.file-attachement.js

As I said, Liferay - Java is not avaliable to get the file when this is draged from the file system.
HTML
              <div class="col-md-12">
                <!-- Advanced File Input -->
                <div class="form-group mb-0">
                  <h4 class="h6 g-font-weight-600 g-color-black g-mb-20">
                    <liferay-ui:message key="neworder.uploadRelatedFile" />
                  </h4>
                  <input class="js-file-attachment" name="fileAttachmentPO[]" type="file" multiple="multiple">
                </div>
                <!-- End Advanced File Input -->
              </div>
JAVA code
12345678
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
Map<String, FileItem[]> files= uploadPortletRequest.getMultipartParameterMap();
for (Entry<String, FileItem[]> file2 : files.entrySet()) {
  FileItem item[] =file2.getValue();
  try {
    for (FileItem fileItem : item) {
      File file = fileItem.getStoreLocation(); <--- File not exist      
      file.exists()  == >  false

Have you any idea if this problem with the component or java perse?

The same behaviour is happening in Chrome and Firefox
0 (0 Votes)

RE: Drag and Drop Not Working
Answer
7/9/21 12:47 AM as a reply to Imagineer Customer Experience.
Hello,

Have you any Javascript errors or Java errors in the Liferay Portal logs?

Regards,
Sabri BEN SALEM
0 (0 Votes)

RE: Drag and Drop Not Working
Answer
7/20/21 5:33 AM as a reply to sabri ben salem.
There is no actual error but the file is named upload_00000059. without any extencion

  • \LiferayWorkspace\bundles\tomcat-9.0.17\temp\upload_00000059.
And its mime type is 
  • application/octet-stream


When the file is upload via Explorer the file exists and its mime type is PDF as expected.
0 (0 Votes)

RE: Drag and Drop Not Working
Answer
7/20/21 10:48 PM as a reply to Imagineer Customer Experience.
Hello,

Can you share with us the code you used to save the File in the Portal. And also the JS plugin file. 

Regards,
Sabri BEN SALEM
0 (0 Votes)