Upload file

<h3>Upload  File</h3>

<form action="@Url.Action("Upload","UploadController")"  method="post" id="uploadForm" enctype="multipart/form-data">
    <div class="file-box">
        <input type="text" class="txt"/>
        <input type="button" value="Browser" class="fileInputbtn"/>
        <input type="file" class="fileInput" id="uploadFile" name="uploadFile"/>
        <input type="button" value="Upload" class="fileInputbtn" id="btnUpload"/>
        <input type="button" value="Cancel" class="fileInputbtn" id="btnCancel"/>
    </div>
</form>

<script type="text/javascript">
    $(document).ready(function () {
        $(".fileInput").change(function () {
            $(".txt").val($(this).val());
        });

        $("#btnCancel").click(function () {
            $(".txt").val("");
        });

        $("#btnUpload").click(function () {
            var filePath = $(".txt").val();
            if (filePath.length == 0) {
                alert("Please upload a file.");
                return;
            }
            var extension = filePath.split(‘.‘).pop();
            if (extension != "xlsx") {
                alert("Please upload a correct file(.xlsx).");
                return;
            }

            $("input[type=‘button‘]").attr("disabled", "disabled");
            $(".button_01").attr("disabled", "disabled");
            $(".error").html("Uploading... please don‘t close the browser.");
            $("#uploadForm").submit();
        });
    });
</script>

  

Upload file

时间: 2024-08-04 08:47:40

Upload file的相关文章

jQuery文件上传插件jQuery Upload File 有上传进度条

jQuery文件上传插件jQuery Upload File 有上传进度条 2015年05月15日 jQuery文件上传插件jQuery Upload File,插件使用简单,支持单文件和多文件上传,支持文件拖拽上传,有进度条显示.标准HTML form文件上传,也就是说,只要服务端支持接收multipart/form-data格式数据就能使用此上传插件. 本站web端文件文件提交即使用此插件,效果如下: 浏览器支持 浏览器支持:IE 8.0,IE 9.0,IE 10.0,Firefox,Saf

ubuntu curl upload file to apache2 server

ubuntu curl upload file to apache2 server Table of Contents 1. install 2. get web info 3. set php upload conditions 3.1. ref 3.2. upload_max_fileszie 3.3. post_max_size 3.4. max_execution_time cfg 3.5. restart after cfg 4. config upload directory 5.

MVC-前台调用后台action 传递upload file 参数问题

在后台获取upload file 数量的时候发现count一直为0,经检查发现了问题 ,代码如下: 前台: var data = $("#DetailForm").serialize(); $.ajax({ url: '@Url.Action("SaveRequest", "RegistrationRequest")', type: "POST", dataType: "JSON", data: data,

Express web框架 upload file

哈哈,敢开源,还是要有两把刷子的啊 今天,看看node.js 的web框架 Express的实际应用 //demo1 upload file <html><head><title>文件上传表单</title></head><body><h3>文件上传:</h3>选择一个文件上传: <br /><form action="/file_upload" method="

html 5 drag and drop upload file

compatible: chrome firefox ie 11 , not supported demo: http://demo.tutorialzine.com/2011/09/html5-file-upload-jquery-php/ http://www.sitepoint.com/author/craig-buckler/page/23/ http://www.sitepoint.com/html5-file-drag-and-drop/ http://www.sitepoint.c

[Selenium] Upload File on Remote Node Machines

Problem: In web UI automation testing, we always need to upload files, it will work well on local machines, but doesn't work on remote node machines when using Seleniuim Grid to run. Solution: No Description Recommendation Index 1 1.Use PathUtils to

httpclient upload file

用httpclient upload上传文件时,代码如下: HttpPost httpPost = new HttpPost(uploadImg); httpPost.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"); httpPost.addHeader("Accept-Encoding&

Using AFNetWorking 2.0 upload file to php web service server based on Slim

Recently i am developing the IOS app, a feature is needed to upload image to the webservice server. I am using the AFNetworking library. The function is as follow. -(void)SendImage:(NSData *)imgData { NSDictionary *parameters = @{@"ShopID": [NSS

ABAP upload file(*.txt *.csv *.xls)

转自:http://blog.csdn.net/jy00873757/article/details/8534492 在SAP我们经常会用到*.txt, *.csv, *.xls三种文件格式 *.TXT 1. 一般用GUI_UPLOAD来处理, 请看下面的例子: [plain] view plain copy TYPES: BEGIN OF ty_luke, key1 TYPE zluke-key1, year1 TYPE zluke-year1, month1 TYPE zluke-month