I don't have any idea to copy a file from client system to server. Short Description
- I am using upload folder dialog box to upload a multiple file from particular path.
- XML file is mandatory, because i need to extract some information to process
While upload event i read all the information i need to process
$("#myInput").change(function() { var names = []; var formData = new FormData(); for (var i = 0; i < $(this).get(0).files.length; ++i) { var F_name= $(this).get(0).files[i].name; var extension = F_name.replace(/^.*\./, ''); if(extension != "xml" && extension != "db"){ formData.append('userfiles[]', $(this).get(0).files[i], F_name); } else if(extension == "xml"){ //Gathering info }} });
User interface fields are filled automatically after this process and user have to fill some more fields. While user click process button in server side i create folder and some new XML files too. Everything is fine except , copy a file from client to server.
//Jquery
$("#process_but" ).click(function() {
$.ajax({
type: "POST",
url: "Asset/PHP/function.php",
data: {action: "action1", DOI:doi, TLA:tla, STITLE:S_Title, SHEAD:S_Head, SLINK:S_Link, LTYPE:link_type, DESC:description, ATITLE:Art_title, JTitle:JOU_title, ANAME:Author_name, FSHARE:Fig_share, FNAMES:filenames, FCOUNT:filecount},
success: function(response) {
if(response == 1)
{alert("success");}
else
{alert("Something goes wrong.....");}
},
error: function() {
alert("Error");
}
});
});
//php
<?php
session_start();
$action = $_POST['action'];
if($action == "action1")
{
//what i have to do
}
?>