You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
$(document).ready(function () {
|
|
$(document).off('click',sendFile).on('click','.upload-it',sendFile);
|
|
$(document).off('click',selectFile).on('click','.select-file',selectFile);
|
|
$(document).off('change',showMsg).on('change','.true-select',showMsg)
|
|
})
|
|
function sendFile() {
|
|
var fileData =new FormData();
|
|
var Url4='student-upload-finished-product';
|
|
var file=$('.true-select').files;
|
|
if($('.true-select').val()=='')
|
|
{
|
|
alert("请选择文件");
|
|
return;
|
|
}
|
|
fileData.append("file",file);
|
|
$.ajax({
|
|
type:"post",
|
|
url:Url4,
|
|
date:fileData,
|
|
processData:false,
|
|
contentType:false,
|
|
success:function (data,status) {
|
|
if(status=="success")
|
|
{
|
|
alert("上传成功");
|
|
}
|
|
}
|
|
})
|
|
}
|
|
function selectFile() {
|
|
$('.true-select').click();
|
|
}
|
|
function showMsg() {
|
|
var file=$(this).val();
|
|
var filename=getmsg(file);
|
|
function getmsg(file) {
|
|
var index=file.lastIndexOf("\\");
|
|
return file.substring(index+1);
|
|
}
|
|
$('.file-msg').css("opacity","1");
|
|
$('.file-name').html(filename);
|
|
$('.file-msg').css("left","340px");
|
|
$('.file-input-frame').css("right","20px")
|
|
$('.select-file').html("重新选择");
|
|
$('.select-file').css("background-color","#eb4548");
|
|
} |