Revision history [back]

How to obtain full file path without using FileUpload in zk

How do we get the full file path, without using FileUpload event? I searched the forums and it seems that the only way highlighted, is to first upload the media and then use media.getName(). But, if I just want to pass the file path rather than upload a 50 MB file, this adds a lot of overhead. How do I get the path without doing this? My current code is given below :-

    if (objUploadEvent != null && (objUploadEvent instanceof UploadEvent)) {

Media media = upEvent.getMedia();

byte[] bFile = media.getByteData();

File myFile = new File(media.getName());
setPackageSource(myFile.getAbsolutePath().toString());
updateModelUi();
}
}


Thanks in advance to any kind soul, who answers my query. Regards and have a nice day!

How to obtain full file path without using FileUpload in zk

How do we get the full file path, without using FileUpload event? I searched the forums and it seems that the only way highlighted, is to first upload the media and then use media.getName(). But, if I just want to pass the file path rather than upload a 50 MB file, this adds a lot of overhead. How do I get the path without doing this? My current code is given below :-

    if (objUploadEvent != null && (objUploadEvent instanceof UploadEvent)) {

Media media = upEvent.getMedia();

byte[] bFile = media.getByteData();

File myFile = new File(media.getName());
setPackageSource(myFile.getAbsolutePath().toString());
updateModelUi();
}
}


Thanks in advance to any kind soul, who answers my query. Regards and have a nice day!

 3 No.3 Revision

How to obtain full file path without using FileUpload in zk

How do we get the full file path, without using FileUpload event? I searched the forums and it seems that the only way highlighted, is to first upload the media and then use media.getName(). But, if I just want to pass the file path rather than upload a 50 MB file, this adds a lot of overhead. How do I get the path without doing this? My current code is given below :-

<button hflex="1" upload="true, maxsize=-1, native" label="..." onupload="@command('onFileUpload')" disabled="@load(stepGeneralVM.isServerEntered)"/> label = "..."


public void onFileUpload(
@ContextParam(ContextType.BIND_CONTEXT)
BindContext ctx) {

Media media = upEvent.getMedia();

File myFile = new File(media.getName());
setPackageSource(myFile.getAbsolutePath().toString());
updateModelUi();
}
}
Thanks in advance to any kind soul, who answers my query. Regards and have a nice day! 


 4 No.4 Revision updated 2021-03-18 01:46:26 +0800 How to obtain full file path without using FileUpload in zk How do we get the full file path, without using FileUpload event? I searched the forums and it seems that the only way highlighted, is to first upload the media and media, then use media.getName(). media.getName(), and finally the getAbsolutePath() method. But, if I just want to pass have the file path rather than upload a 50 MB file, file to do just that, this obviously adds a lot of overhead. How do I get the path without doing this? uploading the corresponding file? My current code is given below :- <button hflex="1" upload="true, maxsize=-1, native" label = "..." onUpload="@command('onFileUpload')" disabled="@load(stepGeneralVM.isServerEntered)"/> public void onFileUpload( @ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) { UploadEvent upEvent = null; Object objUploadEvent = ctx.getTriggerEvent(); if (objUploadEvent != null && (objUploadEvent instanceof UploadEvent)) { upEvent = (UploadEvent) objUploadEvent; Media media = upEvent.getMedia(); File myFile = new File(media.getName()); setPackageSource(myFile.getAbsolutePath().toString()); updateModelUi(); } } Thanks in advance to any kind soul, who answers my query. Regards and have a nice day! 


 About Us | Faq | Help | Privacy Policy | Contact Us Copyright Potix Corporation 2015. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license. Please note: ZK Forum requires javascript to work properly, please enable javascript in your browser, here is how //IE fix to hide the red margin var noscript = document.getElementsByTagName('noscript')[0]; noscript.style.padding = '0px'; noscript.style.backgroundColor = 'transparent'; var i18nLang = 'en'; var scriptUrl = '/' var askbotSkin = 'default'; var enableMathJax = false; askbot['urls']['mark_read_message'] = '/messages/markread/'; askbot['urls']['get_tags_by_wildcard'] = '/get-tags-by-wildcard/'; askbot['urls']['get_tag_list'] = '/get-tag-list/'; askbot['urls']['follow_user'] = '/followit/follow/user/{{userId}}/'; askbot['urls']['unfollow_user'] = '/followit/unfollow/user/{{userId}}/'; askbot['urls']['user_signin'] = '/account/signin/'; askbot['urls']['getEditor'] = '/get-editor/'; askbot['urls']['titleSearch'] = '/api/title_search/'; askbot['urls']['ask'] = '/questions/ask/'; askbot['urls']['questions'] = '/questions/'; askbot['settings']['static_url'] = '/m/'; askbot['settings']['minSearchWordLength'] = 4; /*<![CDATA[*/ if ($.browser.msie) {$("body").addClass("ie"); } $(document).ready(function(){ // focus input on the search bar endcomment var searchInput =$('#keywords'); if (searchInput) { searchInput.focus(); putCursorAtEnd(searchInput); } if (searchInput) { var search = new FullTextSearch(); askbot['controllers'] = askbot['controllers'] || {}; askbot['controllers']['fullTextSearch'] = search; search.setSearchUrl(''); search.decorate(searchInput); } if (askbot['data']['userIsAdminOrMod']) { $('body').addClass('admin'); } });$('#validate_email_alert').click(function(){notify.close(true)}) notify.show(); $('abbr.timeago').timeago(); /*]]>*/ var z_n = "null", z_i = "3.238.99.243"; var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); .stuck{width:332px;height:225px;position:fixed;top:30%;right:-300px;cursor:pointer} .stuck-button-site{width:32px;height:225px;float:left} .stuck-button-site-back{width:32px;height:113px;float:left;cursor:hand;background:url(/m/default/media/images/zk/button_support.png?v=4) no-repeat scroll 0 0} .stuck-button-site-back:hover{background-position:-32px 0} .stuck-panel{background-color:#FCFCFC;box-shadow:0 0 5px rgba(0,0,0,0.2);float:left;height:225px;width:300px} .stuck-panel-header{height:225px;margin-left:25px;margin-top:20px} .learn-more{font-family:Arial;font-size:16px;color:#008db7;text-decoration:none} .learn-more:hover{color:#006684} #support-list-ul{font-family:Arial;font-size:15px;color:#7d7d7d;list-style-image:url(/m/default/media/images/zk/icon_check.png?v=4);margin-top:15px;margin-bottom:15px;padding-left:15px} #support-list-ul li{line-height:26px} .stuck-title{width:250px;color:#517423;font-family:Arial;font-size:24px;margin:0} Support Options Email Support Training Consulting Outsourcing Learn More$("body").click(function(event){if(!$(event.target).closest(".stuck").length)$(".stuck").animate({"right":"-300px"},"slow")});$(".stuck-button-site").click(function(){var stuck=$(this).parent();if(stuck.css("right")!="0px")stuck.animate({"right":"0px"},"slow");else stuck.animate({"right":"-300px"},"slow")}); //todo - take this out into .js file $(document).ready(function(){$("#nav_questions").attr('className',"on"); $('div.revision div[id^=rev-header-]').bind('click', function(){ var revId = this.id.substr(11); toggleRev(revId); }); lanai.highlightSyntax(); }); function toggleRev(id) { var arrow =$("#rev-arrow-" + id); var visible = arrow.attr("src").indexOf("hide") > -1; if (visible) { var image_path = '/m/default/media/images/expander-arrow-show.gif?v=4'; } else { var image_path = '/m/default/media/images/expander-arrow-hide.gif?v=4'; } image_path = image_path + "?v=4"; arrow.attr("src", image_path); \$("#rev-body-" + id).slideToggle("fast"); } for (url_name in askbot['urls']){ askbot['urls'][url_name] = cleanUrl(askbot['urls'][url_name]); }