Dojo Upload file from dijit Tree - javascript

I'm trying to reuse someone's code where am getting list files from a dialog. From the list when I choose a file, I can get the name of the file and other details. Now I need to upload this file once I get it but I've looked around but can't find anything providing such solution, the only thing am coming across is dojo uploader and the like. I just want to be able to upload the file manually and also be able to use it as when I receive a file from dojox.form.Uploader.

Related

changing the list of allowed files in a file upload window

is there a way to change the list of files in the file upload window using js? I know there is another thread here talking about that, but it doesn't answer my question as it's using plugins, whereas I'd like to know if it's possible to do it without plugin. In the browser I'm using the accept attribute already so the files displayed when you hit "Browse" are already filtered but I want to change the list of files in the drop down menu and have, in addition to All files, the other files included as values of the accept property. Is this possible with no plugin?
thanks

Manipulating a HTML file input to dynamically add a link to the selected file WITHOUT uploading the file?

I am not sure if what I am asking is actually possible but let me try to explain. I am trying to allow users to link to a local file, from an internal web application. Instead of having to hard code every link, I was wondering if it was possible to manipulate a HTML file input so that the user could browse to the file they wanted to link to. I do not wish for the files to actually be uploaded anywhere since they are already on a local drive, it seems silly to duplicate them, and down the line this would lead to multiple duplications (the PDF's are per product, and the same product will be referenced on multiple occasions).
I am aware after some research that due to security reasons you are not able to obtain the file path of a selected file unless perhaps by the use of a temporary URL. See here. Unfortunately this seems to be a very temperamental solution and I can't seem to wrap my head around how it works.

P5Js modifying local file such as json or xml or table

P5Js allows you write a json/table/xml file on the disk but I couldn't find a way to modify the existing file.
There is way through which you can open a local file[json/table/xml] in P5js and there is another way thought which you can write/create a file on local disk but I couldn't found how to modify a local file or add a new entry in the existing local json or table or xml file.
P5.Js
P5.Js write a file
P5.Js loadFile
P5.Js Table
reference
I do found some example to this but they are using different technologies
Link
You can.
If you want to use the browser, you have two options:
Use saveTable(), saveJSON(), etc. which will download a file. (Press the edit button in the reference snippet, hit run see what I mean)
Try localstorage for small pieces or data, or use a database otherwise (may require a wee bit of server-side scripting)
With option 1 you'd have a loop like this:
load the file (file browse dialog or drop the file onto the browser (there's a p5.js example for that))
parse and modify the file in p5.js
save/download the file from p5.js
Other options may include using a wrapper for your js code into an application.
As you've mentioned, app.js/electron.js/cordova/etc. will provide options.
It might be worth trying node.js since there already is a p5.js node.js tutorial out there
You can't. (Edit: You can't, unless you do something more complicated like George's answer.)
Think about how scary it would be if JavaScript could modify files on your hard drive. Any time you visited a website, all of the kitten pictures you have might be deleted!
Depending on what you want to do, you might be able to use cookies. Or you might have to create a database and save to that. Or a server. The point is, it's not as simple as modifying a file on the user's computer.
If you really need to modify a file on the user's computer, then you can't use JavaScript. You can use regular Processing in Java mode and deploy as an application, but you can't embed that in a webpage.

Python http server uploading multiple files

I'm using the simplehttpwithupload.py script, which I have linked to below, to host a simple http server where people can upload files to me. Is there a way to modify the source code so that multiple files can be selected for upload at once? Such that when the select file dialog box comes up, users can ctrl/shift click and select several files which will then be uploaded.
https://www.dropbox.com/s/wshzyseignnz78x/simplehttpwithupload.py
Thanks
Is there a way to modify the source code so that multiple files can be selected for upload at once? Such that when the select file dialog box comes up, users can ctrl/shift click and select several files
I'm pretty sure there's not a simple way. Things may have improved, but when I looked into this a year or two ago, the only solution for exactly what you're looking for is Flash based. The problem is that the file selection dialog is on the client side and multiple file selection is not directly supported in the browser.
There is a JavaScript based solution for downloading multiple files, but it doesn't exactly match what you asked for. See Upload multiple files with a single file element for the explanation, and Multiple file uploader: Mootools version for a later, prettier version.
The main idea is:
you can only store file upload information in a file upload element (), you’ll always need to have one element per file to be uploaded.
it’s actually a relatively simple matter to conceal a file element once a file has been chosen, and add a new (empty) one in its place.
To apply the JavaScript solution to simplehttpwithupload.py, you'll have to rewrite the list_directory function.

Download multible files with JavaScript(one Download)

I generate a HTML page with VB.Net which stores several pinks to files. These links are formatted with JavaScript looking like the Windows-Explorer with folders and files. The problem: There are only download links for the files, not for Folders. A folder can contain Subfolders ,a List of Files or a combination of both. So if I want to download a folder, I have to click manually on every file-link. I have not the possibility to insert PHP or another Server-side language.
my question now is:
Is there a client side way to Download them by click on a Folder? I prefer Javascript but If it isn't possible Flash will be ok also.
What you could do is, link the folders to a special ASPX file. In this file, just create a ZIP with all the files inside it, and make the browser download that ZIP file. I think it's the easy way to accomplish what you are trying to.
With Javascript you could open several windows, one with each file downloaded. But I don't think it will please your users.
There is no way in Javascript and as far as I can tell, theres no way to do it in Flash either. A server-side zip is going to be your only way.

Categories