I need to take screenshots and upload to a webserver, what technology should I use? - upload

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 technology 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.

Related

Create an offline version of web application

Question :
Where to start to write an application which can work without internet connection? Exactly like this
Explanation :
Say we have an web application which is already deployed. Since internet is not great in INDIA, I would like to create an offline version of same web application which users/people can access without internet as well. I want them to experience similar stuff of web interface without much of the changes.
One idea that came to my mind is to create a tar ball of contents of application and ship to the people/users. Users will have to use that tar ball to install/configure on their machine so that they can use it. Contents of tar ball is also debatable that what should I enclose in that tar ball. Apache, Technology stack etc etc.
I will be happy to write more in case I have not written precisely. My question is not related to any technology stack but this might be of interest to everyone. Since I am not sure which is the right tag to append here, can anybody from stackoverflow team help to tag right tag. :)
My application is actually in RoR. So, Tagging ruby on rails community. May be they can help here?
As long as your web application contains only flat files (HTML, CSS, JS, text data, etc.) and does not depend on any components that need to be installed, then you can simply distribute those files in an archive (.zip will be more cross-platform-friendly) and the user could open the application by opening the front page in a browser. To make it better for the user, a small application which invokes the user's browser with the local URI should also be included.

can i use input type = file in my single page application

I'm writing my first single page application and have a requirement by where the user is going to need to upload documents and/or images.
Is this a show stopper for using a spa or is there a work around?
I seem to be able to find very little on this on the net so I'm wondering if this requirement would mean creating a normal mvc site?
Its possible to upload files using ajax, so no show stopper there. you might need a controller to accept the file though, but that shouldn't be an issue.
Check out this tutorial on an ajax upload
http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
or you can check out uploadify, i think that does file upload via ajax too

Download entire website

I want to be able to download the entire contents of a website and use the data in my app. I've used NSURLConnection to download files in the past, but I don't believe it is capable of downloading all files from an entire website. I'm aware of the app Site Sucker, but don't think there is a way to integrate it's functionality into my app. I looked into AFNetworking & ASIHttpRequest, but didn't see anything useful to me. Any ideas / thoughts? Thanks.
I doubt there is anything out of the box that you can use, but existing libraries that you mentioned (AFNetworking & ASIHttpRequest) will get you pretty far.
The way this works is, you load the main website. Then you go through the source and find any resources that that page uses to display its contents and link to other pages. You then need to recursively download the contents of those resources, as well as its resources.
As you can imagine, there are few caveats to this approach:
You will only be able to download files that are mentioned in the source codes. Hidden files or files that aren't used by any page will not be downloaded as the app doesn't know of their existence.
Be aware of relative and absolute paths: ./image.jpg, /image.jpg, http://website.com/image.jpg, www.website.com/image.jpg, etc. could all link to the same image.
Keep in mind that page1.html could link to page2.html and vice versa. If you don't put any checks in place, this could lead to an infinite loop.
Check for pages that link to external websites--you probably don't want to download those as many websites have links to the outside and here you downloading the entire Internet to an iPhone with 8GB of storage.
Any dynamic pages (the ones that use a server side scripting language, such as PHP) will become static because they lose their server backend to provide them with dynamic data.
Those are the ones I could come up with, but I'm sure that there's more.

Offline webapp on iPad

I have a website written in php / javascript. It's quite simple, basically :
on the first page it shows a list of category
when a category is clicked, a new page is displayed with a list of pictures (that can be clicked to get a bigger version, using AJAX) and some text details
I'd like to be able to browse this site offline on an iPad, what would be the better way ?
I saw it is possible to add some html5 caching capability, would this be the way to go ?
You should try the HTML5's caching and/or persistent storage feature. You can save app data or even whole files, and either access them from JavaScript to display, or ask the browser to seamlessly display the cached files when there's no Internet connection. Some links may help:
http://www.html5rocks.com/en/tutorials/appcache/beginner/ <- this one is the caching-related
http://dev.w3.org/html5/webstorage/ <- and this is about persistent storage.
Hope that helps, Árpád

Selectively uploading files to a website

My office uses a piece of software that generates XML based reports. These reports also reference images files which are created during the generation of a report.
I'm trying to develop an ASP.NET MVC web app that will allow users to share and collaborate on these reports. The site will read the XML data into a database, as well as store the images files to be viewed on the site.
However, the problem I'm having now is the reporting software generates many more images then are actually needed by my site. After reading through the XML report data my site will typically find that it really only needs a few images uploaded out of all images that were exported by the software.
I don't want to waste bandwidth or time by having the user upload every single image to the site, as most would end up just being deleted after the site reads through the XML file.
Is there any other way to allow a web-app to selectively upload files from a users computer? Ultimately I would like for the site to be able to read in the XML report file, determine what image files it needs, and then proceed to upload only those images.
Could this be accomplished through java script in the page? What about a silver light?
I know I could develop a stand alone executable that would handle parsing the XML and uploading the images. But I'm trying to avoid requiring the user to install anything to use this site.
unfortunately for security reason it's not very easy to have a web app access the local drive and copy files to the server. However, here are some suggestions:
Create an activeX that has full access to the users computer. (IE Only, has to be installed) basic activex, old example to upload files.
Create an applet, similar to ActiveX (cross browser). Example
Completely different idea, but maybe a bit simpler, you could have the user upload the xml, the server would determine which images it needs and display it to the user. The user could then do a multiple file upload of just the files you listed.
Best of luck.

Resources