Showing posts with label Drag. Show all posts
Showing posts with label Drag. Show all posts
Friday, June 21, 2013
How to check FileReader support this browser on not.(Drag,Drop);.
Drag drop file uploading doesn't support all browser.
Please find this post here
it's not working IE 9,8,7 and IE 10 compatibility view.
for this issue i have created this post how to check current browser support on not.
find this javascript code bellow.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script type="text/javascript">
<!--
function check(){
if (typeof window.FileReader === 'undefined') {
alert('fail');
} else {
alert('success');
}
}
//-->
</script>
</head >
<body onload="check()">
</body>
</html>
Tuesday, June 18, 2013
How to Drop your file using dropupload in zk
index.zul
<?page title="Auto Generated index.zul"?>
<window title="Drop here" border="normal" width="100%" height="100%"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.demo.DropFileViewModel')">
<dropupload maxsize="5120" detection="none"
onUpload="@command('doUpload')">
</dropupload>
<button label="Download" onClick="@command('doDownload')"></button>
</window>
DropFileViewModel.java
package com.demo;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.util.media.Media;
import org.zkoss.zhtml.Filedownload;
import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zul.Messagebox;
public class DropFileViewModel {
Media media;
@Command
public void doUpload(@ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) {
UploadEvent upEvent = null;
Object objUploadEvent = ctx.getTriggerEvent();
if (objUploadEvent != null && (objUploadEvent instanceof UploadEvent)) {
upEvent = (UploadEvent) objUploadEvent;
}
if (upEvent != null) {
media = upEvent.getMedia();
Messagebox.show("File Uploaded: " + media.getName());
}
}
@Command
public void doDownload() {
if (media != null)
Filedownload.save(media);
else
Messagebox.show("First Drop Your File");
}
}
Check online demo here
Subscribe to:
Posts (Atom)
How ChatGPT can Benefit Coding: Your Guide to Leveraging an AI Language Model
Introduction: Hello, coders! Welcome to this blog post on how ChatGPT, an AI language model, can benefit your coding skills and projects. A...
-
It is a Fun Love calculator algorithm to find out love percentage. It is only for fun. You can check FLAMES Game . Here is Java...
-
index.jsp < HTML > < HEAD > < TITLE > Display file upload form to the user </ TITLE > </ HEAD > ...
-
Introduction: Hi everyone! Welcome to this blog post on how to use ChatGPT, an AI language model that can answer your questions, generate te...
