Upload files using angularjs without php script - javascript

just want to ask if it is possible to upload files (images, docs, pdf, etc.) using angularjs without actually using php script, instead all file uploads will use angularjs or javascript codes?. With this method i will be able to lessen the server load. Thanks

That is not possible.
AngularJS is solely a frontend framework. In order to upload something, you need to communicate with a server.

Related

How can I get files and file names using JavaScript?

I am making a website that contains mainly static articles, and I wanted to just access .txt files from a directory and have the pages dynamically created that way when the site is loaded using JavaScript. However, I am struggling to find a way to get access to the files (The files would be in a folder wherever the site is being hosted along with the actual web pages and then I would be extracting the text from these files and creating the pages that way). Is this at all possible without having to use server side code or are there any recommendations for creating the pages another way? I would really like to avoid going through all of the trouble of continually adding html pages for every single article as that would be pretty monotonous and I currently don't have any back-end code and would like to keep it that way if possible. Any recommendations in general would be appreciated.
This is not possible without a backend server. Code running in browser is not allowed to access the files on the system due to security reasons.
Either write a simple backend service to fetch those text file or access those text file data by converting the text files as JavaScript files and declaring text data as variables. Then load these files before your main JavaScript file. Now you can access the data as variables in your main js script.
It is not possible in the traditional open file, read file and close file paradigm.
You could create a web service on your server that would return data from a file using ajax, such as the contents of the text file. But without any backend code, it will not be possible since there would be a lot of security implications if the client-side code was able to do so without any server-side code.

Html 5 file upload and how to send a file from a browser to backend

I've seen a few tutorials of how to use Html5 File API such as this https://www.html5rocks.com/en/tutorials/file/dndfiles/ for file uploading. What I want is a few pointers of how to send all that from a browser to backend and process it there to actually upload files. In those tutorials it's not shown.
The backend language doesn't matter.
And I don't want to use an external js library, only pure javascript.

GWT offline, load json data in html

i got the following scenario. Im using GWT as an offline application. i stored my data as json in a js file and im including this js file in the html page of the GWT application. Im getting the included json data via jsni methods.
my Problem is, that when i use this offline (file://), the application has a very long startup time (ca 10 seconds at ~ 5mb json data file).
Interesing is, that when i put my application to a webserver and access my application there (http://), it loads without any loading time.
is there a difference in the file / http protocol when loading html files which include js files?
Is there a better way to use gwt offline with data?
If the data is static and is always needed in your app, you can use a TextResource instead of wrapping it in a JS file.

Using HTML5 file input to select file from web server

Is there anyway I could javascript or just modify the html5 file input tag to select files from my web server? this is a content management kind of problem so security is not an issue, and if possible i would like to restrict it to a particular directory in the web server. Am not trying to upload or download anything, I already have a way of uploading the files to the web server, am just looking for a way to point to them if you will.
Thanks in advance

Is it possible to use the File JavaScript api to load a server side file?

A quick question, I recently checked out the new html5 File api for javascript. See it here. Is it possible to use it to pull in a server side file without ajax? I know there's a File object in JavaScript, could I do a "new File("serverSideStuff.xml");" with that?
From the API description -
Using the File API added to the DOM in HTML5, it's now possible for
web content to ask the user to select local files, then read the
contents of those files.
So no, you can't select server side files
No, it is only for local files, as I know.
It is not possible because the user must be aware of what your are loading, and is the user who can tell you what you can load or not.

Categories

Resources