Importing/Exporting file in React-Native app - javascript

We have a js file which we want to save via a button into txt/json and make it exportable. Also when we press that button to save the file, to prop a box where we can choose where the file is gonna be saved. Furthermore we want to be able to import thet file later.
Is it possible?
Thanks in advance.

Related

Select a known file via another button in html

I am trying to select a specific file by clicking on another button.
This answer uses JavaScript and triggers the entry of the hidden file. The result can be seen here.
In my case, I already know the name of the file I want to select. I also know its directory.
Is there a way to pass this file name to a function? Something like document.getElementById('my_file').click(fname);
where fname = 'image/img.png'.
No. The only way is to open the file selection dialog and select the specific file. There's no way to tell it which file to select or from which directory to start.

How to upload same file twice in angularjs?

I am using angular-file-upload
I am taking file input in a dialog, my flow is as follows:
User open dialog, Upload File, User Closes the dialog
The issue is, when the user opens the dialog next time, without refreshing the page (obviously), the previous file name is still there next to "browse" button. But when user click on upload, it doesn't upload the same file, even if the user re select the same file. I know it has something to do with the onchange event but how to solve this in angularjs?
I tried resetting the model attached to file input, but no luck.
Try to set replaceFileInput config to true

blueimp file upload - uploads previous selected files

I have this implemented to so it should upload one file at a time. So the user selects a file, clicks upload and then moves on to the next file.
But what the system seems to do is to store the previously selected files and so when the user hits the upload button it sends multiple requests.
I've made sure there is no "multiple" in the html file input box and changed name="files[]" to name="files".
singleFileUploads is set to true
is there a way to reset the file "array" so only one file is stored at a time?
Thanks in advance
I was also going through the same problem hope the link below helps you in this
Delete files programatically with jquery fileupload basic

Symfony 2 form field - image preview instead of file path

I write an application with Symfony 2. I have a form which has a file field.
When there is no file chosen the view is a button of "choose file" and on the right of it text 'No file chosen'. When i select a file, the file-name appears on the right of the button.
I would like to change this behaviour:
When no file is chosen, show only the button.
After choosing a file, instead of showing the file-name I would like to generate a preview of the image.
Anyone has a simple solution for this problem?
Thanks!
you can change the css of the input type file to visibility:hidden and display a button there... and you can make a jquery event like this
$(document).ready(function(){
$("#idofbutton").click(function(){
$("#idofinputtypefile").trigger('click');
});
});
and the rest you can use an iframe stimulate the upload event.
for jquery file upload please check the code link this link
http://www.phpletter.com/Demo/AjaxFileUpload-Demo/
hope this helps

Detect when user has selected a file for upload (without timers)

I would like to to create a 2-step file uploader:
Open dialog.
Select one file from computer.
I would like to eliminate the step where the user must submit the form, and instead do it automatically with JavaScript. Is there anyway to achieve it?
Thanks.
Setting an onChange event and checking for whether the ".value" of the upload field is "!= null" does the trick for me. However, accessing file upload fields programmatically is always a shaky issue, and things can change with future browser security updates.
If you want to be sure, use a flash based upload component like SWFUpload.

Categories

Resources