13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>File Uploads</title>
 
    <!-- ExtJS -->
    <script type="text/javascript" src="../../examples/shared/include-ext.js"></script>
    <script type="text/javascript" src="../../examples/shared/options-toolbar.js"></script>
 
    <!-- Shared -->
    <link rel="stylesheet" type="text/css" href="../shared/example.css" />
 
    <!-- GC -->
 
 
    <!-- Example -->
    <script type="text/javascript" src="file-upload.js"></script>
    <style type="text/css">
        .upload-icon {
            background: url('../shared/icons/fam/image_add.png') no-repeat 0 0 !important;
        }
        #fi-button-msg {
            border: 2px solid #ccc;
            padding: 5px 10px;
            background: #eee;
            margin: 5px;
            float: left;
        }
        .x-debug .x-form-file-wrap .x-form-file-input {
            filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0.6);
            opacity: 0.6;
            background-color: gray;
        }
    </style>
 
</head>
<body>
    <h1>File Upload Field</h1>
 
    <p>This example demonstrates use of Ext.form.field.File, a file upload field with custom rendering.</p>
    <p>The js is not minified so it is readable. See <a href="file-upload.js">file-upload.js</a>.</p>
 
    <h2>Basic File Field</h2>
    <p>
        A typical file upload field with Ext style. Direct editing of the text field cannot be done in a consistent,
        <br>
        cross-browser way, so it is always read-only. The file path reported by the <code>getValue</code> method will
    </p>
    <div id="fi-basic"></div>
    <div id="fi-basic-btn"></div>
 
    <h2>Button Only</h2>
    <p>
        You can also render the file input as a button without the text field, with access to the field's value via the
        <br>
        standard <tt>Ext.form.field.Field</tt> interface or by handling the <tt>fileselected</tt> event (as in this example).
    </p>
    <div id="fi-button"></div>
    <div id="fi-button-msg" style="display:none;"></div>
    <div class="x-clear"></div>
 
    <h2>Form Example</h2>
    <p>
        The File field can also be used in form layouts just like any other field, with support for labeling,
        <br>
        validation (the field is required in this example), empty text, etc.  This example also demonstrates
        <br>
        using the <tt>buttonConfig</tt> option to provide a customized icon upload button.
    </p>
    <div id="fi-form"></div>
 
    <h2>Form Example with failure returned from server</h2>
    <p>
        This is the same as the form above, except that the server simulates an upload error and returns a failure JSON packet.
        <br>
        Explanatory messages are returned in the data packet and processed by the UI.
        <br>
        You may set the HTTP response status which the server responds with. It is recommended that applications
        return a 200, <code><b>success</b></code> response when returning failure packets. The <b>HTTP</b> request
        is successful. The error is an application-level failure.
    </p>
    <div id="fi-form-failure"></div>
</body>
</html>