Nanoframework webserver download/upload file - nanoframework

I've searched a lot but couldn't find an example.
I want to use nanorframework as a webserver where I can upload and download e.g. a JSON file from the browser which holds all my settings. Is this possible?
Otherwise if I want to change some settings I have to rebuild the whole solution and uploat it.
Thanks in advance

You can use the Storage libraries to store that Json file. The actual storage can support by flash (using SPIFFs), SD card or USB mass storage device. This depends on the hardware platform that you are using. Check the Storage samples in our samples repo here.
Downloading a file is pretty straightforward you just need to serve the respective HTTP request. Check the HTTP samples in our samples repo here.
Uploading a file it's a matter of handling the POST request and grabbing the data being sent by the client browser.

Related

How to get around storage quota limits in a progressive web app

My question is essentially how can I get around the storage quota limits enforced on a PWA? A little background...
I am hoping to create an offline-ready line-of-business progressive web app that would ideally push about 2GB of images and video resources onto my user's phones or tablets - well beyond the current storage quota for caches and Indexed DB. What I'd like to be able to do is have my users (we all work at the same company) do a 1 time download of a zip file or directory and have the user's store that on their phone/tablet's file system in a well known directory. As the online version of the app treats these files as URL's, the fetch api would seem ideal since I could serve from online if connected or the local serviceworker managed cache if not online. But the qouta limits have me stumped. None of the files are larger than 15MB, but there's no way to know which files are needed before a user goes offline. Can I use something like an HTML input type=file tag to load files into the cache at runtime and then treat them as URL's? Of course I would remove other files to make room. But since these files wouldn't be coming from "the origin" with its secure https address (a PWA requirement I think) , but rather a local file system, I'm not sure this will work. If it is workable, would my users be forced to browse to the files manually?
If its an option, you can have a native Android service to do the caching part to avoid space constraint and then serve the data from native code to PWA using websockets/secure web sockets.
No PWA solution possible for now. File API has limitation as its sand-boxed.

Controlling if download is successful from s3 to user

I'm using s3 to allow users to download files directly from frontend a limited number of times.
Problem is I need to know if a download was successful before I update the number of download left.
Is there any way I can get any kind of control over it like s3 callback when download finished or something?
The only thing I found was Server Access Logging but after reading trough the
Best Effort Server Log Delivery section I think I need something a bit more deterministic than that.
No, this capability is not possible. It is not possible to receive a notification when an object has been accessed. The logs are the only indication of activity.
If this is a vital need, then you will need to serve the file via your own application.

Show content of a zip file in a browser, rather than downloading it

I have a log server, where users upload archives and view their content online when needed. Currently the server unzips files, right after receiving them. Unfortunately, my peers consumed all the drive space I had. I can free up a lot of space, if there's a way of storing ZIP archives, but feeding them to users as HTML page (same as default Apache's file browser).
I know there are solutions relying on JS, like:
http://gildas-lormeau.github.io/zip.js/demos/demo2.html
https://stuk.github.io/jszip/
or I can unzip them on demand at server side and provide link to a temporary folder. However, some time ago I've heard a browser can view an archive content if proper headers are sent from Apache/nginx. Apache's mod-deflate doesn't help much here and I can't find other docs - perhaps it's not possible after all?
Cheers.

Upload medium or larg file size in host (images,multimedia files,...) without ftp protocol

How can make a uploader file in vb6 to work easyly and can be uploade files into host.
For example (images or multimedia files or other format) and size > small size files for exampe > 500kb or 1 mb , 2 mb or upper sizes .
Please help me to can find any way to designed without ftp protocols.
I think it is possible to use of msxml refrences but i don't know how can designed it by msxml .
[thanks]
You could upload to a HTTP like dropbox. The downside of simple HTTP file transfer is that it is fairly easy for somebody to grab your credentials using a common tool like Fiddler. However that is also the case with FTP just a bit harder. The upside to uploading to dropbox is that you could have any file size (providing you have the space on your dropbox account).
I haven't tried using the dropbox upload api yet but you can read the documentation here, take a look at the PUT and POST methods: https://www.dropbox.com/developers/core/docs
If you just wanted to upload to dropbox and you have the dropbox client installed you could just save the file to the dropbox folder on your computer and it would auto upload.

Suppose a server is hosting a video file. Why is it that sometimes, it requires a full download before playing. Sometimes, I can stream it?

Someone told me that some servers configure it that allow streaming of a file.
OR
Is it a file-encoding problem, not a server configuration problem?
Given a link of the video file, how do I check if that person allows streaming (or play only once downloaded) ? Headers?
In order for a file to be streamable, all of the information necessary to initialize the decode and playback engines must be at the beginning of the file. Not all file formats are designed in that way. (for instance, with AVI files usually the index is at the end).
But the server must also be configured to stream. Transferring a file over HTTP or FTP is a different protocol than streaming the file.
So it's both, for streaming to work everything has to be setup correctly, the server and the file must support it. If either one is not set up correctly, then transferring the file usually works. Transferring the file is the conservative or fallback solution.
As long as the encoding format is such that the information in the file is chronological with respect to the video frames, there is no theoretical possible way for a server to allow downloading but not playing. Think about it. If you have the data, and it's playable after downloading, that portion is playable before downloading is complete.