I am building a peice of software that needs to allow a user to take a screenshot of his/her computer which will then be uploaded to a web server.
What tec开发者_运维知识库hnology should I use? I don't think js has access to the appropriate resources, but would like to keep it browser based. Help?
nope ... javascript won't work ... you need some lib which takes a screenshot and another one which does the upload.
in .net there are builtin libs for both (taking screenshots, upload via ftp)
edit:
choose a technology which is able to create a screenshot and post it to an external resource via POST
(or upload it via FTP
). therefore you will need some access to local file-system ... well ... what would you think if you, as a novice, get prompted to allow access to local-filesystem (or network-resources)?
edit2: as far as i know, silverlights support taking screenshots ... and there would be some ftp/post action included as well ..
Javascript by itself cannot handle this, nor should any webpage based technology --- if a website could covertly upload files from it's visitor's computers, it would have great hacking capability. Similarly for doing things like automatically taking a screenshot -- That's too much control for a user to give up to an unknown website.
So, any means of uploading a file will requires directly user interaction. With that, a simple HTML form with a <input type="file" />
element should be all that is needed.
精彩评论