Upload file to remote server using ajax - ajax

I don't have any control on the server side..
is it possible to upload and load the results given by the remote server in an Iframe ?
please share some code..
Thanks

Declare the iframe with a name and target that name in your form element:
<form action="http://url.to.server" enctype="multipart/form-data" target="resultsFrame">
<input type="file" />
...
</form>
<iframe src="blank.html" name="resultsFrame"></iframe>

Related

Oracle Apex to receive form submit POST data

I am new to Oracle Apex.I am trying to receive POST data in Oracle Apex page. I want to submit a HTML form and receive that post submission in my Oracle Apex app. searched web but couldn't get suggestions.
In my Oracle database 11g, I have configured Apex 18.1 which is running in 8085 port and created some basic pages.
<!DOCTYPE html>
<html>
<body>
<h2>HTML Forms</h2>
<form action="http://localhost:8085/apex/f?p=106:4:9735956410807:::::" method="post">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
<p>If you click the "Submit" button, the form-data will be sent to Oracle Apex page.".</p>
</body>
</html>
This POST submission will be from external source and Apex app should process this submission.
Thanks in advance.
There are a couple options here:
You could create a webservice using APEX Restful services and sending there. It's probably much safer than exposing you application like you are doing. Worst case scenario you'll have to convert you form post to a json on the backend of the original app, which should be easy pease.
Why not just create a public page with an APEX form and execute a process after the submit happens? You have a tool that generate forms and you are building one from scratch?
*** Having said that, you might want to have the page in a different domain, site, etc... I still think you would be better telling on the other site that the person would be redirected and then sending it to the APEX form

AJAX call to PHP not working yields a blank page

We are implementing the "forget password" feature for our website.
We are usign HTML, JQquery mobile and AJAX .
we have a main file, which has the hyperlink for the forget password using the '' tag.
The password.html has form elements as below:
<form method ="post" id="forget" action="somefile.php" >
<h4>Enter your login email to change your password..</h4>
<label for="email" class="ui-hidden-accessible">Email:</label>
<input type="email" name="email" id="email" value="" placeholder="email" data-theme="a" />
<input type="submit" value="Submit" data-theme="b" />
</div>
</form>
The php file validates the email and sends the response in JSON format , which we are handling through a ajax call.
The problem is after hitting on "submit" in the password.html, we are able to retreive the data from the php file(able to see in network tab of browser) but it does not display on the frontend.
The browser is navigating to the php file (which it should not) and a blank page is being displayed.
Ps: When we directly load the password.html in the browser the behaviour is absoultely fine , but when we are navigating from the main file usign the hyperlink to password.html then this problem occurs.

Load external website using ajax

I want to load an external site from different domain [like: http://iqecommerce.com] in the iframe when I click the button by using jquery-ajax. I also want to show 'imafsdges' div as an ajax loader in the iframe before loading is complete.
My following code is like below
<input type="button" id="check1" value="Click to load" /><br/>
<div id="imafsdges" style="display:none;"> Loading</div>
<iframe id="theiframe" class="frameToChange" name="some" width="70%" height="400px"> </iframe>
Example: http://jsfiddle.net/YSd9g/

AJAX file upload with progress bar and input types

I need to submit form which contains two inputs:
<form action="upload" method="post" accept-charset="utf-8" enctype="multipart/form-data"
id="upload">
<textarea name="file_description"></textarea><br/>
<input type="file" name="userfile" id="userfile" /><br/>
<input type="submit" name="upload_button" value="upload"/>
</form>
This question maybe duplicate of this, but I tried and get errors. Can anyone guide me with submitting form which contains file and other inputs?
You can use XHR2 and FileAPI. It's new HTML5 API with pretty good browser support by now. XHR2 allows you to send files via AJAX and FileAPI is used to get file content from input[type=file]
There are plenty articles on that subject in the web. For example: Processing XHR2 file uploads in PHP

MVC 3 File Upload

I want to use mulitple File uploaders on my Razor view form. For this I tried File upload Web helper (#FileUpload.Gethtml()) but unable to call desired controller action. Any help on this or some other way will be highly appreciated.
Thanks
Vivek
You could use a simple html form with multiple file upload inputs and set the form action to post your controlle action
For example
<div>
<h2>File Uploads Updates</h2>
<form action="/FileUpload/UploadMultiple" method="post" enctype="multipart/form-data">
<label for="file">FileAt:</label>
<input type="file" name="fileA" id="fileA" /><br />
<label for="file">FileB:</label>
<input type="file" name="FileB" id="FileB" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
</div>
See Also this Hanselman post on how to do file uploads in MVC
If you're willing to use third party controls, take a look into Telerik upload control.
It is an open source one (GPL 2 ? license)

Resources