Skip to content

xiong-ang/WCT_Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WCT_Server

A back-end framework for web compareTool project.

How to Run:

  1. Install MongoDB
  2. Create DB:
    webct
    |
    -----_users
    |
    -----_compareResults
  3. Restor library by nuget
  4. Ctrl + F5 on VS

Completed Prototype

MongoDB DAO

  1. MongoDB Entity
  2. DAO Design

JWT Token

  1. JWT
  2. JWT
  3. JWT by C#

Web API Cros

.Net两种Cros配置方式

FileUpload by FormData

//Front-end
var form = $('form')[0]; // You need to use standard javascript object here
var formData = new FormData(form); 
$.ajax({
    url'Your url here',
    dataformData,
    type'POST',
    contentTypefalse, // NEEDED, DON'T OMIT THIS (requires jQuery 1.6+)
    processDatafalse, // NEEDED, DON'T OMIT THIS
    // ... Other options like success and etc
}); 

// OR

var data = new FormData();
jQuery.each(jQuery('#file')[0].files, function(i, file) {
    data.append('file-'+i, file);
}); 
data.append('key1', 'value1');
data.append('key2', 'value2');

jQuery.ajax({
    url'php/upload.php',
    datadata,
    cachefalse,
    contentTypefalse,
    processDatafalse,
    method'POST',
    type'POST', // For jQuery < 1.9
    successfunction(data){
        alert(data);
    }
});
//Back-end
public bool Post()
{
    string value1 = HttpContext.Current.Request["key1"];
    string value2 = HttpContext.Current.Request["key2"];
    HttpFileCollection files = HttpContext.Current.Request.Files;

    foreach (string f in files.AllKeys)
    {
        HttpPostedFile file = files[f];
        if (string.IsNullOrEmpty(file.FileName) == false)
            file.SaveAs(HttpContext.Current.Server.MapPath("~/App_Data/") + file.FileName);
    }

    return true;
}

About

Web Compare Tool Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published