Concurrent File upload to s3 - file

I want to upload multiple files from HTML form to S3 using S3 POST. Currently for uploading a single file(2.5MB) S3 POST took 2 mins to upload.
Is it possible to upload two files in parallel so that the total upload time to S3 is less.

You can use AJAX to do this. Basically, use an XMLHttpRequest for each upload, so you can start them both in parallel.
Unfortunately, this will only work on browsers that let you access File inputs from JavaScript -- I don't think IE supports this.
A framework like jQuery or ExtJS may help you work around browser weirdness. ExtJS does file uploads by creating hidden iframes and submitting the form to load in the iframe. That way, you can create multiple hidden iframes and do multiple uploads at once.

Related

How can I download a NextJS page as a static HTML file?

so I have this website made with Next and on a page there are some graphs (the graphs content changes as it fetches an API) and info.
I want to add a button to the page and when pressed it download the page as a HTML file and includes all the JS and CSS in the HTML file instead of separately, does anyone have any idea as to how to approach this problem. (The graphs content should be the same content as it was on the time of downloading)
(The reason why I want to do this is because I want to distribute these files to others and I want to allow them to read it w/o an internet connection)
You can't really download a React 'page' because there are no pages in React to download.
Next further complicates this because it server-side renders everything and rehydrates client-side. If you inspect one of your pages, you'll see the JSON blocks Next uses for data. Look for the __NEXT_DATA__ script (usually in the footer of your page).
I think the two strategies you could use:
Screen-capture of the graphs during your build sequence and push them over to an AWS S3 bucket or similar (cumbersome)
When I ran into a requirement like this, I just made the data for the graph available as a JSON download just below the graph and it satisfied the use case sufficiently.
If you just want to download the assets and take a look, a workaround is probably leveraging the next/export package. This allows you to run yarn build and generate a static export of your entire site. This should include the file you're looking for.
Just some ideas to think through.

How can I pull remotely stored PDFs to be viewed in Ionic?

I have a site where PDFs are uploaded and stored (all exactly the same way) as (publicly available) attachments on a web page.
Using an Ionic app, I want to query the site and pull in the PDFs as a list where each item can be opened and read in the app. The PDFs would remain on the site/server, but would be available through the Ionic interface to be read as pages.
What kind of setup or services would I need for something like this?
It seems to me like you'd want an API that simply lists the available PDFs and the URL/Location for them. That would be better than the ionic app trying to parse HTML from your existing site (which is what it sounds like you're considering). Then the ionic app can call this service and get the PDF listing in JSON, which is very natural.
Then if the PDFs are externally accessible (meaning no token/security required), the display of the PDF should be a simple window.open() call.

Is there an upload queue feature for ng-file-upload?

Would it be possible using this library? I've used this one for uploading a single file or a batch of files but it only creates a single http request, just like the samples in its github page. What I'm looking for is have an upload queue for the user's upload files so that he/she can still select another file for upload while previous file is still in uploading.
You can just have an array (queue) in your javascript code that holds all the files and once a new file is selected start uploading it and push it to the array.
Alternatively you could achieve this by adding ngf-keep="true" directive which will keep adding the new files to the model while holding the previous ones.
with ng-file-upload you can do multiple file select dialog for async file uploads. It then gives the upload progress of all files during the concurrent file uploads.
e.g. file 1 - 50%
file 2 - 75%
I can vouch for this because Ive done it.
See usages ...
https://github.com/danialfarid/ng-file-upload#usage
can't see any reason why u could not allow the user to select another file whilst the files were uploading.
Just click the upload button again!

Uploading images for inline content without an html editor

I've got a client with a D7 site in which all content is created by a single employee who knows html and css, but never accesses the back end. Is there a way to let them upload images to embed in content (not a field) without installing an html editor? No styles are used or needed. The images are created just as they need to use them.
Have you already looked at the IMCE module?
IMCE is an image/file uploader and browser that supports personal directories and quota.
https://drupal.org/project/imce

Display image stored as blob using GWT RPC

I'd like to display images I've stored as Blobs in a GWT rendered page using RPC. I don't want to use a servlet because then loading the images is synchronous, and if I have many images can slow down the page load times. Any ideas?
Using a Servlet is the best way to serve images. Browsers do not block on image downloads. On the contrary, they start downloading images and other resources in parallel threads (it was earlier restricted to 2 threads, but newer browsers have relaxed that limit).

Resources