How do I pass XML data to php upload to server - php

Please assist, I have the below code.
I am creating a an XML file and then attempting to post this data to my PHP file on the server so that it can save the file to the "uploads/" Directory where my 3rd party program will pick it up and extract the selected data.
My question is: How can I pass the xmlNew Data into a file and then pass that file to the "upload" functionality?
HTML:
//Several fields listed here.....
//Then:
<form method="post" enctype="multipart/form-data">
<input type="file" name="files[]" multiple>
<input type="submit" value="Upload File" name="submit">
</form>
JS:
$(function () {
$('#DownloadButton').click(update);
})
var template = [
'<?xml version="1.0"?>',
'<unattend xmlns="urn:schemas-microsoft-com:unattend">',
'<Data>',
' <SubmitBy><?SubmitBy?></SubmitBy>',
' <Level1><?Level1?></Level1>',
' <Level2><?Level2?></Level2>',
' <Level3><?Level3?></Level3>',
' <Level4><?Level4?></Level4>',
' <Title><?Title?></Title>',
' <Subject><?Subject?></Subject>',
' <Author><?Author?></Author>',
' <Keywords1><?Keywords1?></Keywords1>',
' <Keywords2><?Keywords2?></Keywords2>',
' <Destroy_Date><?Destroy_Date?></Destroy_Date>',
'</Data>',
'</unattend>'
].join('\r\n');
function update() {
var variables = {
'SubmitBy': $('#SubmitBy').val(),
'Level1': $('#Level1').val(),
'Level2': $('#Level2').val(),
'Level3': $('#Level3').val(),
'Level4': $('#Level4').val(),
'Title': $('#Title').val(),
'Subject': $('#Subject').val(),
'Author': $('#Author').val(),
'Keywords1': $('#Keywords1').val(),
'Keywords2': $('#Keywords2').val(),
'Destroy_Date': $('#Destroy_Date').val(),
};
var newXml = template.replace(/<\?(\w+)\?>/g,
function(match, name) {
return variables[name];
});
$('#ResultXml').val(newXml);
$('#DownloadLink')
.attr('href', 'data:text/xml;base64,' + btoa(newXml))
.attr('download', 'xml_Export.xml');
$('#generated').show();
}
if (!window.btoa) {
btoa = function (input) {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var result = '';
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
do {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
result += chars.charAt(enc1) + chars.charAt(enc2) + chars.charAt(enc3) + chars.charAt(enc4);
} while (i < input.length);
return result;
};
}
PHP:
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_FILES['files'])) {
$errors = [];
$path = 'uploads/';
$extensions = ['jpg', 'jpeg', 'png', 'gif', 'xml'];
$all_files = count($_FILES['files']['tmp_name']);
for ($i = 0; $i < $all_files; $i++) {
$file_name = $_FILES['files']['name'][$i];
$file_tmp = $_FILES['files']['tmp_name'][$i];
$file_type = $_FILES['files']['type'][$i];
$file_size = $_FILES['files']['size'][$i];
$file_ext = strtolower(end(explode('.', $_FILES['files']['name'][$i])));
$file = $path . $file_name;
if (!in_array($file_ext, $extensions)) {
$errors[] = 'Extension not allowed: ' . $file_name . ' ' . $file_type;
}
if ($file_size > 2097152) {
$errors[] = 'File size exceeds limit: ' . $file_name . ' ' . $file_type;
}
if (empty($errors)) {
move_uploaded_file($file_tmp, $file);
}
}
if ($errors) print_r($errors);
}
}
Any assistance would be greatly appreciated.
Thank you all!

A quick demo to show how you could send, using ajax, the XML as a string to the PHP server which would write the data to a file.
<?php
if( $_SERVER['REQUEST_METHOD']=='POST' && !empty( $_POST['xml'] ) ){
$file = __DIR__ . '/ytm.xml';
$bytes = file_put_contents( $file, $_POST['xml'] );
exit( sprintf('%d bytes written to %s',$bytes,realpath($file) ) );
}
?>
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<title>send XML data to server to be written to file</title>
<script>
var template = [
'<?xml version="1.0"?>',
'<unattend xmlns="urn:schemas-microsoft-com:unattend">',
'<Data>',
' <SubmitBy><?SubmitBy?></SubmitBy>',
' <Level1><?Level1?></Level1>',
' <Level2><?Level2?></Level2>',
' <Level3><?Level3?></Level3>',
' <Level4><?Level4?></Level4>',
' <Title><?Title?></Title>',
' <Subject><?Subject?></Subject>',
' <Author><?Author?></Author>',
' <Keywords1><?Keywords1?></Keywords1>',
' <Keywords2><?Keywords2?></Keywords2>',
' <Destroy_Date><?Destroy_Date?></Destroy_Date>',
'</Data>',
'</unattend>'
].join('\r\n');
const ajax=function( params ){
with( new XMLHttpRequest() ){
onreadystatechange=function(e){
if( this.status==200 && this.readyState==4 ){
alert( this.response )
}
}
open( 'POST', location.href, true );
setRequestHeader('Content-Type','application/x-www-form-urlencoded');
send( params );
}
}
document.addEventListener('DOMContentLoaded', ()=>{
document.querySelector('input[ type="button" ]').addEventListener('click', e=>{
let vars={};
Array.prototype.slice.call( document.querySelectorAll('form > input[ type="text" ]') ).forEach( field =>{
vars[ field.name ]=field.value
});
let xml=template.replace(/<\?(\w+)\?>/ig, (match,name)=>{
return vars[name];
});
ajax.call( this, 'xml='+xml );
})
});
</script>
</head>
<body>
<form method='post'>
<input type='text' name='SubmitBy' value='bob' />
<input type='text' name='Level1' value='alpha' />
<input type='text' name='Level2' value='bravo' />
<input type='text' name='Level3' value='charlie' />
<input type='text' name='Level4' value='delta' />
<input type='text' name='Title' value="geronimo's revenge" />
<input type='text' name='Subject' value="why is trump such a twit" />
<input type='text' name='Author' value='bill shakespeare' />
<input type='text' name='Keywords1' value='love,death,taxes' />
<input type='text' name='Keywords2' value='cat,dog,fox' />
<input type='text' name='Destroy_Date' value="2019-03-01" />
<input type='button' value='Send the XML' />
</form>
</body>
</html>

Related

php Activating On Page Load While Inside Of onsubmit

I have a php function to create a file in a directory on submission of a form.
The code is:
<form id="myForm" onSubmit="<?php
error_reporting(E_ALL);
$directory = __DIR__ . "/images/"; $filecount = 0; $files = glob($directory . "*"); if ($files){
$filecount = count($files); }
$filecount = $filecount + 1;
$pagename = 'image_'.$filecount;
$newFileName = './images/'.$pagename;
$newFileContent = 'Page Content';
if (file_put_contents($newFileName, $newFileContent) !== false) {
echo "File created (" . basename($newFileName) . ")";
} else {
echo "Cannot create file (" . basename($newFileName) . ")";
}
?>">
<input placeholder="Username 0/25" name="user" id="user" maxlength="25" required>
<input placeholder="Password 0/45" name="password" id="password" maxlength="45" required>
<input placeholder="Image Name" name="name" id="name">
<input type="file" placeholder="Image" accept="image/*" name="img" required>
<button type="submit">Upload</button>
</form>
The problem is that it auto activates on page load.. is there a way to fix that
The problem is that it auto activates on page load
to prevent auto loading the page when you press on submit, you could use this trick "return false; \"..." but it doesn't create the image file :/ just stop the page from action.
if (file_put_contents($newFileName, $newFileContent) !== false) {
echo "return false; \"File created (" . basename($newFileName) . ")";
} else {
echo "return false; \" Cannot create file (" . basename($newFileName) . ")";
}
I try to imitate you're project, however i used txt files instead of images.
I used AJAX
index.html
<html>
<body>
<form id="myForm">
<button type="submit">create a file</button>
</form>
<script src="script.js"></script>
</body>
</html>
script.js
document.getElementById('myForm').onsubmit = function(e){
e.preventDefault();
var xhr = new XMLHttpRequest();
xhr.open('GET','creating.php');
xhr.onreadystatechange = function(){
console.log(xhr.readyState)
if(xhr.readyState == XMLHttpRequest.DONE)
if(xhr.response.startsWith('Woow'))
alert('File created successfully!');
else
alert('Something went wrong!');
}
xhr.send();
}
creating.php
<?php
$directory = __DIR__ . "/files/";
$filecount = count(glob($directory . "*")) + 1;
$newFileName = $directory.'txt_'.$filecount.'.txt';
$newFileContent = "some text... in a file number $filecount.";
if(file_put_contents($newFileName, $newFileContent))
echo "Woow!";
else
echo "Oups!";
?>

Php file upload

Php code
$target = "upload/";
$nameF = "";
$targetImage = "upload/";
$nameI = "";
if (!empty($_FILES['fileUP']['name'])) {
print_r("ce il file");
$target = $target . basename($_FILES['fileUP']['name']);
$nameF = $_FILES['fileUP']['name'];
if (!move_uploaded_file($_FILES['fileUP']['tmp_name'], $target)) {
echo -1;
}
}
if (!empty($_FILES['imageUP']['name'])) {
$targetImage = $targetImage . basename($_FILES['imageUP']['name']);
$nameI = $_FILES['imageUP']['name'];
if (!move_uploaded_file($_FILES['imageUP']['tmp_name'], $targetImage)) {
echo -1;
}
}
$title = $_POST['title'];
$admin = $_POST['admin'];
$content = $_POST['content'];
$sql = "INSERT INTO news (title,admin,content,img,file) values('$title','$admin','$content','$nameI','$nameF')";
$result = $conn->query($sql) or die(mysql_error());
if ($result === TRUE) {
echo 1;
} else {
echo -1;
}
Form
<form enctype="multipart/form-data" id="insert" class="bs-example bs-example-form" method="POST">
<div class="input-group">
<span class="input-group-addon">Titolo</span>
<input id="title" name="title" type="text" class="form-control" placeholder="Titolo">
</div>
<br>
<div class="input-group">
<span class="input-group-addon">Admin</span>
<input id="admin" name="admin" type="text" class="form-control" value='{{$utente|lower}}'
placeholder='{{$utente}}'>
</div>
<br><br> <br> <br>
<div class="input-group">
<span class="input-group-addon">Immagine</span>
<input id="image" name="imageUP" accept="image/*" type="file" class="form-control"
placeholder="Immagine">
</div>
<br>
<div class="input-group">
<span class="input-group-addon">File</span>
<input id="image" name="fileUP" id="fileToUpload" type="file" class="form-control"
placeholder="FIle">
</div>
<br>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-font"></span></span>
<input id="content" name="content" type="text" class="form-control"
placeholder="Contenuto">
</div>
<br>
<button id="crea" type="submit" class="btn btn-warning">Crea</button>
</form>
Ajax request
$('#insert').submit(function (e) {
e.preventDefault();
var data = new FormData($(this)[0]);
$.ajax
({
url: 'uploads.php',
data: data,
type: 'post',
processData: false,
contentType: false,
success: function (response) {
response = parseInt(response);
switch (response) {
case -1: //errore generico
alert("errore");
break;
case 1:
alert("la creazione della news è andata a buon fine");
break;
}
close ajax call..
My problem is:
the script work but not well, i've notice that query don't insert data if i put text in the 'content' input and upload image.
In the console I've this error:
not allowed to load local resource: file:///C:/fakepath/xx.jpg
when i work in localhost i haven't this error and query ALWAYS insert data. Now i've problem and i am in real server.
Anyone know to fix it?ù
I need your help
Try this. And, let me know. Use whole code as it is. I will explain in few minutes. First try.
$target = "upload/";
$nameF = "";
$targetImage = "upload/";
$nameI = "";
$flag = 1;
if (!empty( $_FILES['fileUP']['name'])) {
print_r("ce il file");
$target = $target . basename( $_FILES['fileUP']['name']);
$nameF =$_FILES['fileUP']['name'];
if (!move_uploaded_file($_FILES['fileUP']['tmp_name'], $target)) {
$flag = -1;
}
}
if (!empty( $_FILES['imageUP']['name'])) {
$targetImage = $targetImage . basename( $_FILES['imageUP']['name']);
$nameI =$_FILES['imageUP']['name'];
if (!move_uploaded_file($_FILES['imageUP']['tmp_name'], $targetImage)) {
$flag = -1;
}
}
$title = $_POST['title'];
$admin = $_POST['admin'];
$content = $_POST['content'];
$sql = "INSERT INTO news (title,admin,content,img,file) values('$title','$admin','$content','$nameI','$nameF')";
$result = $conn->query($sql) or die(mysql_error());
if ($result === TRUE) {
$flag = 1;
}
else {
$flag = -1;
}
if($flag == -1){
echo -1;
} else {
echo 1;
}

Uploading files in to Files folder

I want to upload files in to webroot/files folder, but my controller doing nothing, is there any mistake ?
View file name: uploadfile.ctp
Controller name: UploadFileController.php
Model name: UploadFile.php
In my view file I have:
<div class="files">
<input type="file" name="files[]" /><br/>
</div>
<button type="button" class="plus">+</button> <br><br>
<form name="frm1" method="post" onsubmit="return greeting()">
<input type="submit" value="Submit">
</form>
<?php echo $this->Html->script('addFile');
addFile script :
$(document).ready(function() {
$(".plus").click(function() {
$(".files").append("<input type='file' name='files[]'/><br/>");
});
});
And my Controller, I think that a mistake is somewhere here :
public function uploadFile() {
$uploadedFile = $this->request->params['UploadFile']['files[]']['tmp_name'];
$dir = WWW_ROOT . 'files/';
if ( !is_dir( $dir ) ) {
mkdir($dir);
chmod( $dir , 777);
}
$fileName = 'file_' . date( 'Y_m_d_h_i_s', time() );
move_uploaded_file( $uploadedFile, $dir. $fileName);
}
I got one Notice to:
Notice (8): Undefined index: UploadFile [APP\Controller\UploadFileController.php, line 7]
Thank you for any clue !
Solution
View File (uploadfile.ctp) :
<?php
echo $this->Form->create('uploadFile', array( 'type' => 'file'));
?>
<div class="input_fields_wrap">
<label for="uploadFilefiles"></label>
<input type="file" name="data[]" id="uploadFilefiles">
</div>
<button type="button" class="add_field_button">+</button> <br><br>
<form name="frm1" method="post" onsubmit="return greeting()">
<input type="submit" value="Submit">
</form>
<?php
echo $this->Html->script('addFile');
Controller (UploadFileController.php) :
class UploadFileController extends AppController {
public function uploadFile() {
$filename = '';
if ($this->request->is('post')) { // checks for the post values
$uploadData = $this->data;
//print_r($this->data); die;
foreach($uploadData as $file){
if ( $file['size'] == 0 || $file['error'] !== 0) { // checks for the errors and size of the uploaded file
return false;
}
$filename = basename($file['name']); // gets the base name of the uploaded file
$uploadFolder = WWW_ROOT. 'files'; // path where the uploaded file has to be saved
$filename = $filename; // adding time stamp for the uploaded image for uniqueness
$uploadPath = $uploadFolder . DS . $filename;
if( !file_exists($uploadFolder) ){
mkdir($uploadFolder); // creates folder if not found
}
if (!move_uploaded_file($file['tmp_name'], $uploadPath)) {
return false;
}
echo "Filename: $filename<br>";
}
}
}
}
Script (addFile.js) :
$(document).ready(function() {
var max_fields = 2;
var wrapper = $(".input_fields_wrap");
var add_button = $(".add_field_button");
var x = 1;
$(add_button).click(function(e){
e.preventDefault();
if(x <= max_fields){
x++;
$(wrapper).append("<div><input type='file' name='data[]' id='uploadFilefiles'/><button href='#' class='remove_field'>Kustuta</button></div>");
}
});
$(wrapper).on("click",".remove_field", function(e){ //user click on kustuta text
e.preventDefault(); $(this).parent('div').remove(); x--;
})
});

Image uploader with preview didn't work

I have a single file named test.php. In this file, I written below codes to upload a picture (.PNG and .JPG). I also add some code to make a preview of pictures before being uploaded...
Nothing seems to be wrong but when I press the SUBMIT button, nothing happens...
Why? Where is my problem?
Update: I make changes and now I get this warning:
Warning: Invalid argument supplied for foreach() in...
test.php:
<script type="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<body>
<?php
if ( isset( $_POST[ 'submit' ] ) ) {
define ("UPLOAD_DIR" , "uploaded/pic/");
foreach ($_FILES["images"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$name = $_FILES["images"]["name"][$key];
$info = getimagesize($_FILES["images"]["tmp_name"][$key]);
$image_type = $info[2];
$type = $_FILES['images']['type'][$key];
// if the image is .JPG or .PNG
if ( ($image_type == 3) || ($image_type == 2) ){
// ensure a safe filename
$name = preg_replace("/[^A-Z0-9._-]/i", "_", $name);
// don't overwrite an existing file
$i = 0;
$parts = pathinfo($name);
while (file_exists(UPLOAD_DIR . $name)) {
$i++;
$name = $parts["filename"] . "-" . $i . "." . $parts["extension"];
}
// preserve file from temporary directory
$success = move_uploaded_file($_FILES["images"]["tmp_name"][$key], UPLOAD_DIR . $name);
if (!$success) {
echo "<p>Unable to save file.</p>";
exit;
}
// set proper permissions on the new file
chmod(UPLOAD_DIR . $name, 0644);
echo "<h2>Successfully Uploaded Images</h2>";
}
else{
echo "<h2>format not supported... </h2>";
}
}
}
}
?>
<div id="upload_form">
<form id="frm1" name="frm1" method="post" action="test.php" enctype="multipart/form-data">
<p>
<label for="images">insert your image</label>
<input type="file" name="images" id="images" tabindex="80"/>
</p>
<img id="pic" name="pic" src="#" />
<button type="submit" id="submit" name="submit">Upload Files!</button>
</form>
<script type="text/javascript" language="javascript">
// Preview the picture before Uploading on the server!
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#pic').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#images").change(function(){
readURL(this);
});
</script>
</div>
You need to put your name="images as an array using []
Like this:
<input type="file" name="images[]" id="images" tabindex="80"/>

Page freezes after sending form

I have a script that has the following content:
<?php
if(isset($_POST['sent-urls']) || $_POST['sent-urls'] == true)
{
session_start();
error_reporting(E_ALL);
//ini_set('display_errors', 'Off');
include('includes/functions.php');
$url = str_replace('www.', '', url());
$images = explode("\n", $_POST['remote-urls']);
if(sizeof($images) > 30) {
$url_i = $url_t = $direct = 'You have added mroe than 30 links';
}
$links = array();
foreach($images as $image)
{
$srcfile = (isset($image)) ? trim($image) : '';
$extension = remoteEx($srcfile);
$filename = rand(124588, 543354) . '.' . remoteEx($image);
$file = remote_filesize($srcfile);
if ($file <= 3000000 && !empty($srcfile) && $extension == 'png' || $extension == 'peg' || $extension == 'jpg' || $extension == 'gif' || $extension == 'bmp')
{
$copied = copy($srcfile, 'i/' . $filename);
$direct = $url . 'i/' . $filename;
$url_i = $url . 'i/' . $filename . "\n";
if ($copied)
{
// make_thumb($direct, 't/' . $filename, 150, remoteEx($direct));
generate_thumbnail($image, $filename, 110, 110, true, 'file', false, false, '');
$url_t = $url . 't/' . $filename . "\n";
}
}
else if (empty($srcfile))
{
$url_i = $url_t = $direct = 'No links added';
}
else if ($file > 3000000)
{
$url_i = $url_t = $direct = 'Maximum size of photos exceed';
}
else
{
$url_i = $url_t = $direct = 'There was an error while submitting the form';
}
$links[] = array('direct' => $direct, 'thumb' => $url_t);
}
if ($file > 3000000) { echo 'You have exceed the limit of the file size'; }
echo '<br /><br />';
echo '<div id="links">';
echo '<table>';
echo "<tr><td><span class=\"green\">Direct:</span> <textarea class=\"link-area\" readonly=\"readonly\" onMouseOver=\"this.focus(); this.select(); $(this).css('height', '50px');\" onmouseout=\"$(this).animate({ height: '25px' }, 'fast'); $(this).blur();\">";
for($i = 0; $i < count($links); $i++) { echo $links[$i]['direct'] . "\n"; }
echo '</textarea></td></tr>';
echo "<tr><td><span class=\"green\">Thumbnail:</span> <textarea class=\"link-area\" readonly=\"readonly\" onMouseOver=\"this.focus(); this.select(); $(this).css('height', '50px');\" onmouseout=\"$(this).animate({ height: '25px' }, 'fast'); $(this).blur();\">";
for($i = 0; $i < count($links); $i++) { echo $links[$i]['thumb'] . "\n"; }
echo '</textarea></td></tr>';
echo "<tr><td><span class=\"green\">BBCode:</span> <textarea class=\"link-area\" readonly=\"readonly\" onMouseOver=\"this.focus(); this.select(); $(this).css('height', '50px');\" onmouseout=\"$(this).animate({ height: '25px' }, 'fast'); $(this).blur();\">";
for($i = 0; $i < count($links); $i++) { echo '[IMG]' . $links[$i]['direct'] . '[/IMG]' . "\n"; }
echo '</textarea></td></tr>';
echo "<tr><td><span class=\"green\">HTML:</span> <textarea class=\"link-area\" readonly=\"readonly\" onMouseOver=\"this.focus(); this.select(); $(this).css('height', '50px');\" onmouseout=\"$(this).animate({ height: '25px' }, 'fast'); $(this).blur();\">";
for($i = 0; $i < count($links); $i++) { echo '<img src="' . $links[$i]['thumb'] . '" />' . "\n"; }
echo '</textarea></td></tr>';
echo '</table>';
echo '<script type="text/javascript" src="scripts/img.core.js"></script>';
echo '<script type="text/javascript" src="scripts/jquery-1.5.js"></script>';
echo '<input type="reset" id="resetbtn-remote" class="button-sub" value="Reset" />';
echo '<br />';
echo '</div>';
}
else
{
header('Location: index.php');
}
?>
And the script gets called by this form:
<div id="remote" style="display: none;">
<form action="remote.php" method="post" id="remote-upload">
<br /><br />
<textarea name="remote-urls" id="remote-urls" rows="12"></textarea><br/>
<input type="button" name="remote-start" id="remote-start" class="remote-button" value="Upload Images" />
<input type="hidden" name="sent-urls" value="1" />
<input type="reset" id="remote-reset" class="remote-button" value="Reset" style="display: none;" />
<br /><br />
<span class="normal">
Maximum <strong>20</strong> images. <strong>10 MB</strong> for one image.
</span>
</form>
<div id="remoted">
<img id="loader1" src="css/images/loader.gif" style="display: none;" />
</div>
</div>
The form is connected with a jQuery plugin that send data from a form without refreshing the page. I hit the #remote start button, loader shows, and after a few seconds the page freezes and becomes inaccessible for ~4 seconds, then the page unfreezes with the desired results.
What might be causing the page to freeze?
EDIT: The JavaScript is like this:
$('#remote-start').live('click', function() {
$('#loader1').show();
$(this).hide();
$('#remote-reset').show();
$('#remote-upload').ajaxSubmit({
target: '#remoted',
success: function(response) {
$('#remoted').html(response).hide().slideDown('fast');
$('#loader1').fadeOut('normal');
}
});
});
$('#remote-reset').live('click', function() {
$('#remote-urls').empty();
$('#remoted').slideUp('medium', function() {
$(window.location).attr('href', 'http://localhost/imagehost');
});
});
$('#resetbtn-remote').live('click', function() {
$('#remote-urls').empty();
$('#remoted').slideUp('medium', function() {
$(window.location).attr('href', 'http://imgit.org');
});
});
Hard to say but I'd guess that your "jQuery plugin that send data from a form without refreshing the page" is calling $.ajax with async:false:
Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.
The plugin is using AJAX and the above excerpt from the $.ajax documentation sounds exactly like what you're seeing.

Categories