New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I get real path of local file? #6
Comments
hi thanks ....
There is currently no way to get ...(but last day, I feel the need of that
too)
btw, you can do easily by requesting the server ...
create a rpc method serverside, "getPath", and request it clientslide
wuy.getPath() ...
…On Thu, Dec 20, 2018 at 8:56 AM zyhwhu2009 ***@***.***> wrote:
Hi,
Very nice tool! I use ell first and now try to use wuy, and I think it's
more convenient and powerful.
How can I get real path of local file by in html?
Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJMwp7DWFImvNf8iuX_UByPlGFry0_vks5u60KmgaJpZM4ZbruY>
.
|
Thank you for your prompt reply. I am new and still do not know how to create a rpc method serverside. could you give me a example or reference. |
Here is an exemple, for serverside mode (note that : it doesn't have sense in window mode, because client & server are on the same host) that's a drag'n'drop example : drop a text file on the page, it will be sent to the server via the upload rpc method ;-) if you want to do it with binary file, just replace with # -*- coding: utf-8 -*-
import wuy
class index(wuy.Server):
"""
<script>
function mydragover(e) {
e.target.style.background = "red";
e.preventDefault()
}
function mydragend(e) {
e.target.style.background = "white";
}
function mydrop(e) {
e.target.style.background = "white";
for(var f of e.dataTransfer.files) {
var reader = new FileReader();
reader.onload = function (ee) {
wuy.upload(f.name,ee.target.result)
};
// reader.readAsDataURL(f);
reader.readAsText(f);
}
e.preventDefault()
}
</script>
<body
ondragover="mydragover(event)"
ondragleave="mydragend(event)"
ondragend="mydragend(event)"
ondrop="mydrop(event)">drop on me</body>
"""
def upload(self,name,content):
# here, on server side : save the file 'name', with the text 'content',
print("server:",name,content)
if __name__=="__main__":
index() |
help me a lot!!! |
Hi,
Very nice tool! I use ell first and now try to use wuy, and I think it's more convenient and powerful.
How can I get real path of local file by in html?
Thanks.
The text was updated successfully, but these errors were encountered: