Disable Drag and Drop programatically - fine-uploader - fine-uploader

Once a user has uploaded a file via any means (file selection, DnD or Cut and Paste), I would like to disable the Upload widget, to prevent users to upload again.
This disabling should be done for a specific upload widget since I may have many on the same page.
Is there a method I can call to do this?
Thanks.

Simply present an alert/message to the user in your UI once they are no longer able to upload additional files (which you should do no matter what) and then return false in your onValidateBatch handler for all subsequently dropped/selected files. This will prevent files submitted via the file chooser, file submitted via DnD, AND pasted images from being uploaded.

Related

How to keep page editable during file uploads (Laravel)?

I work on a Saas project where users can submit/upload items.
I want to create a similar work-flow like Youtube.
This means that the user uploads image file, ZIP files etc. which then show in the upload progress block, during this time I want the user to be able to edit the other informations like tags, text description, price for item etc.
At Youtube a user can upload a video file and edit all other things during the upload, he can even leave the page and the upload continues in the background.
But in my project whenever a user uploads a file these fields can not be edited properly or get removed again after the upload is successful.
Please point me to a solution how this works/how Youtube et al approached this.
Thanks.
I think you should do this with javascript features
Like sending a file with ajax in laravel and php.
By doing this, you can still access the elements inside your web page.

Uploading image via Slack interactive button

I have such interactive button I place at the bottom of backend-generated message:
The button click calls the dialog:
If I enter the public URL of an image in the 'URL' field it is successfully sent to the backend and I'm able to update the backend-generated message with an image. But instead of uploading file somewhere and copying it there I'd like to click 'upload image' in the dialog and select file from a disk. Is this possible?
No. Uploading files is currently not supported by Slack Dialogs.
But you could implement it yourself with an upload script that runs in the browser and is called by a link button from Slack. This would work similar to this example for a file download.
The link button is a variation of an message button and has to be placed in a message (e.g. next to your Add note button), but can not be placed inside the Dialog.
Here is the basic outline:
User clicks on "Add image" button in message
Browse opens and runs upload script
The upload script requests the user to specify which file to upload
Script uploads the file (e.g. to your server or Slack) and links it to
the user's request
Things to consider:
You have to link the current session with your script, e.g. by transferring an ID in the link (which might infer security concerns)
This upload function will not be modal like you dialog, so your app needs to be able to handle an asynchronous / parallel upload of files
Check out these pages for more details on uploading files via browser:
What is the best way to upload files in a modern browser
Using files from web applications

Initial Files List on demand

I have 6 fineuploader instances in a single page but different tabs (show/hide divs). I do need to display previous session uploaded files, but my challenge is that if all fineuploader instance starts to display in all tabs, it is going to long time for user to see first tab as each uploader instance will have 50-100 images.
My question....is there any trick in which I can trigger the fineUploader init files upon user clicks on the tab?
As of Fine Uploader 5.6.0, you can add initial files to the library at any time with the addInitialFiles API method. So when your user clicks on the tab, you can retrieve your initial files list from the server (or wherever it exists) and then pass this data to addInitialFiles.

What's the common way to handle AJAX file uploads/preventing orphaned files?

I'm planning to use FineUploader.js to give my users the ability to drag 'n drop images, select multiple at once, etc... and, maybe more importantly, have the image uploading while they complete the rest of a form.
I'll be using the ASP.NET MVC/.NET 4.5/C# platform for this project.
What if the user don't complete the form? If they actually hit a cancel button I could probably fire a command to delete the images that have already uploaded. What about if they simply close the browser?
How to prevent files from being uploaded, but not used?

Firefox addon - is it possible to capture text/html from the webpage?

I have never wrote a firefox addon so I am wondering if this can be done. Is it possible to continually scan a webpage for certain text, and then if that text appears, capture it and save it to a file?
For example
Say a user is on amazon and adds a few items to their shopping cart.
They click checkout and fill in their details and click submit order.
When the order is processed the user is shown the text 'Order complete' and given a receipt of their purchase.
In this example I would like to keep scanning the webpage until 'Order complete' appears. Then I want to capture the html of the receipt and save it to a file.
Is this possible with a firefox addon?
From my experience as a Firefox user, this is definitely possible. As a matter of fact there are add-ons that do far more than that.
For example, Greasemonkey can actually act as a filter and change the content of a viewed webpage as specified by a user script. Zotero and AlertBox are able to selectively watch specific HTML elements for interesting information and act upon it.
It is also quite possible that there is an existing add-on that either does what you need already, or can be used as a basis for a custom add-on of your own - what you are asking for is not all that unusual...
You probably want to create your add-on with the Add-on SDK. You can then use the page-mod package to attach a content script to Amazon pages. The content script should check whether it got loaded into an order confirmation page - and send the HTML code of that page (probably document.body.innerHTML) back to the extension.
The extension then needs to write the data to a file. You need to use internal API for that, something like this:
var file = require("file");
var writer = file.open("c:\\foo\\bar.html", "w");
writer.writeAsync(data);
If you want the user to choose the file name, you can do this using chrome authority and nsIFilePicker component.

Resources