0

Toolbar click download not working.

asked 2022-10-04 14:32:27 +0800

SSD gravatar image SSD
151

Hello EveryOne, I want to upload and download pdf file, it uploads well but at the time of download using toolbar button link click, it is only loading page but cant download.

<zk> <window id="mainInputWindow" apply="com.bi.ekyc.composer.InputForm_Mod_Composer" width="100%">

    <label id="user" sclass="user_label" />
    <borderlayout height="700px">

        <west sclass="menu_back">

            <panel class="scroll-down">
                <panelchildren>

                    <panel title="eKYC and eCRP">
                        <panelchildren>
                            <grid id="fileAttachmentGrid" >
                                <rows>                                  
                                <!-- <row>
                                        <cell id="attachmentCell" colspan="8">
                                            <toolbarbutton id="attachedFileTbBtn" />
                                            <toolbarbutton id="removeFileTbBtn" />
                                        </cell>
                                    </row> -->
                                    <row id="fileAttachmentRow" visible="false" >
                                        <cell id="attachmentCell" colspan="3">
                                            <toolbarbutton id="attachedFileTbBtn"  />
                                            <toolbarbutton id="removeFileTbBtn" />
                                        </cell>
                                        <cell colspan="1">
                                            <label id="upload_date"  />
                                        </cell> 
                                        <cell id="fileLabelCell" colspan="1">
                                            <label value="File:" />
                                        </cell>
                                        <cell id="buttonCell" colspan="7">
                                            <toolbarbutton upload="true" id="fileAttachmentTbBtn" />
                                        </cell>                                                                                                                             
                                    </row>

                                </rows>         
                            </grid>

public void onUpload$fileAttachmentTbBtn(Event event) {

    isFileUploadNow = true;
    // String uploadedFileName ;
    try {
        UploadEvent uploadEvent = (UploadEvent) ((ForwardEvent) event).getOrigin();
        Media m = uploadEvent.getMedia();

        uploadedFileName = m.getName();
        System.out.println("Uploaded File Name: " + uploadedFileName);

        // saving File Temp Location
        fileUpdDelUtil.saveTempFile(m, bulk_ul.getUSER_ID());

        int isFileAllowed = fileUpdDelUtil.validateUploadedFileType(m,
                fileUpdDelUtil.WIN_TEMP_DIR_PATH + "/" + bulk_ul.getBRANCH_CODE() + "/" + m.getName());
        if (isFileAllowed == 1) {
            // setting the form for file is Attached
            filePresent();

            // limiting file name to 45 letters and if its less than 50 leaving it as it is
            if (uploadedFileName.length() > 50) {
                attachedFileTbBtn.setLabel(uploadedFileName.substring(0, 45));
            } else {
                attachedFileTbBtn.setLabel(uploadedFileName);
            }

            // setting the attributes to insert in database and other functionalities
            attachedFileTbBtn.setAttribute("filePath", fileUpdDelUtil.WIN_AUD_PATH_URL);
            attachedFileTbBtn.setAttribute("filePathDir", fileUpdDelUtil.WIN_AUD_DIR_PATH);

            // setting controls properties for Toolbar button
            attachedFileTbBtn.setTooltiptext(uploadedFileName);
            attachedFileTbBtn.setStyle(ResourceUtility.fontColorBLUE);
            attachedFileTbBtn
                    .setHref(fileUpdDelUtil.WIN_TEMP_PATH_URL + "/" + bulk_ul.getUSER_ID() + "/" + m.getName());
            attachedFileTbBtn.setTarget("_blank");
        } else {
            Messagebox.show(
                    "upload Failed  Not Allowed \nSelect Only " + fileUpdDelUtil.getKnownFileExt() + "File Type");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

image description image description

delete flag offensive retag edit

Comments

updated your karma so that you can include links and images.

jeanher ( 2022-10-07 09:27:20 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-06 17:47:28 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2022-10-06 17:49:35 +0800

You don't attach your screenshot successfully. Could you attach it again? That would help others understand your problem better. According to the current information, it's hard for me to tell the root cause.

Is attachedFileTbBtn the button to download a file?

What do you mean "... loading page but cant download...."? Do you mean: after clicking the button, your browser shows a PDF file, but cannot download it, is it?

Have you ever checked the generated link, fileUpdDelUtil.WIN_TEMP_PATH_URL + "/" + bulk_ul.getUSER_ID() + "/" + m.getName() is correct or not?

Suggest you to open the browser developer tool > network and console tab (press F12) to check if there is any error or unexpected result:

image description

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2022-10-04 14:32:27 +0800

Seen: 6 times

Last updated: Oct 06 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More