i have created a form to make a submission to an api using axios.
There are 3 other parameters and then the files to submit.
I got it working with one file but what I need to do is be able to have multiple files uploaded and then submit, i tried using the multiple flag but this seems to only allow you to select multiple files in the same folder at once rather than choosing and selecting the files individually.
I don’t want the files sent to the api until the submit button is clicked though.
I thought maybe about using local storage to put the files and then pull to submit at once when the button is clicked?
You can use Base64 encode in client side and add the encoded string to your post request and decode from server side.
Related
I have a form that allows the user to upload several images to a server. This form also allows the user to edit the form as well depending upon qs parameters. As additional information, I am using redux-saga with react, just to provide more background.
I am able to upload the image and allow the user to preview the image after they make their selection and before they upload it. However, upon reviewing the documentation, I do not see a way to populate the react-dropzone field when the user edits the other form items. I saw a way to do a preview onDrop but not with data coming from the server. I also found this article on Stackoverflow because am not sure if it could be applied to my case within the redux-saga scenario: How to add the URL of an image already uploaded, to Dropzone?.
Can this be done and if so how can it be achieved?
I've been given a URL for the swagger frontend, offering the documentation for a number of POST, GET, PUT and DELETE requests and I need to extract all requests (possibly as cURL commands), without opening each of the items and manually copying the request.
How?
According to https://petstore.swagger.io/ the app is written in React and it's not possible to see the curl request before you click on the section (because it's not in HTML tree at that point). You can try to install CJS plugin for chrome and write jQuery that:
creates temporary textarea
clicks through all necessary sections, their try now button and then their execute button
copies .curl contents to the temporary textarea
After that you can simpy copy the contents of the textarea to a textfile or something.
I want to use something along the lines of JQuery file upload (i'm open minded) in a form with lots of other fields for the UI (ex. image previews, delete, file sizes .etc), but I want to submit the files along with the form as if i used a normal HTML file field.
Is this at all possible?
If you console.log() the form after submission you will get an object in return that has a bunch of information. Among that information you can find for example file information of the file you just upload.
You can check this http://jsfiddle.net/1r0Lprkj/1/ and open your console after you've submitted the form.
Then if you want to go deeper into this, then you can check out the Javascript FileReader which lets you do a bunch of cool stuff with the uploaded file. https://developer.mozilla.org/en-US/docs/Web/API/FileReader
To answer your question; Yes it is possible to achieve without AJAX.
Action class in struts 2 is model driven to a bean.
In the form submit there are several form data(text field) and the file upload tag. When i try to remove all the filetags and submit then the bean value is populating but if i include the file tags then the form data are not been populated.
Is it possible to send both multiple file upload and form data to server in a single form submit?
It is working fine problem is actually in firebug resend request. When actual formsubmit it is working fine but while resending the same request it is not working.
I need to upload image or file when user selects that file like in gmail attach file without any other asp:button . What I mean is there shouldn't be any other button except fileupload control. And when a file is selected the file will be uploaded to the server folder.
How to implement that?
Please help.
Take a wee peek at this. Jquery + flash solution.
http://www.uploadify.com/demo/
That is done using JavaScript/AJAX. You can't do it only with ASP.NET controls.
Take a HTML control and use the "onchange" event of this control. Make a asp code file and write the file's upload code on that file. Now use Ajax and to send request to asp's code file.
When you will select file it will automatically upload by ajax. Because Html control events doesn't use server side.