2021年8月6日 星期五

uploadfile php

 <?php echo  $_FILES["fup"]["name"]; ?><br>

<?php echo  $_FILES["fup"]["size"]; ?><br>

<?php echo  $_FILES["fup"]["type"]; ?><br>

<?php echo  $_FILES["fup"]["tmp_name"]; 

move_uploaded_file($_FILES["fup"]["tmp_name"],"updown/a2.png");

?>


還真容易!

還真容易錯!

1、有updown子目錄?

2、有png檔?

3、move_uploaded_file 不要拼錯

4、$_FILES[]..不是 $_POST[]

5、$_FILES["fup"].,fup外面要加""

6、html與 php中的參數名稱及目錄名稱要一致,updown, upfile, upload都可以,但不可以前後

不一樣

7、updown 與 /updown差一個斜線,會讓你頭大

8、要有目的位置檔案名稱

9、還要去php.ini改upload_max_filesize=5M

10、錯在哪裡?

11、反覆試的耐心

12、找錯誤的細心

13、google 下關鍵字的技巧

14、基本功: 編輯能力、網站概念、網頁概念、程式概念...

15、背景知識:#xamp #php #相對目錄 #網頁間資料傳送 

...

...

有空再補充!...


複製貼上一秒就可以用,恭喜你!

但複製貼上後,又改了10次才成功,恭喜你!有了解決問題的能力!

uploadfile html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>無標題文件</title>

</head>


<body>

<form action="fup.php" method="post" enctype="multipart/form-data" name="form1" id="form1">

  <label for="fup"></label>

  <input type="file" name="fup" id="fup" />

  <input type="submit" name="submit" id="submit" value="送出" />

</form>

</body>

</html>

LIS 、LCS VB.Net

 Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'in 9 15 7 6 11 12 4 out 9 11 12 ,輸出要求,和最大的LIS 

        Dim ins = "9 15 7 6 11 12 4"

        Dim data1 = ins.Split(separator:=" ", options:=System.StringSplitOptions.RemoveEmptyEntries)

        Dim n = UBound(data1)

        Dim d(n) As Int16

        For i = 0 To n

            d(i) = data1(i)

        Next

        Dim d1(n) As Int16

        d.CopyTo(d1, 0)

        Array.Sort(d1)


        Dim c(n, n)

        Dim cf(n, n)


        For i = 0 To n

            c(i, 0) = 0

            c(0, i) = 0

        Next i

        Dim path As New ArrayList

        For i = 1 To n

            For j = 1 To n

                If d(i) = d1(j) Then

                    c(i, j) = c(i - 1, j - 1) + 1

                    cf(i, j) = 3

                    path.Add(d(i))

                Else

                    c(i, j) = Math.Max(c(i, j - 1), c(i - 1, j))

                    If c(i, j) = c(i, j - 1) Then cf(i, j) = 2

                    If c(i, j) = c(i - 1, j) Then cf(i, j) = 1

                End If

            Next

        Next

        MsgBox(c(n, n))


        Dim ss = ""

        For i = 0 To n

            For j = 0 To n

                ss = ss & c(i, j)

            Next

            ss = ss & vbNewLine

        Next

        MsgBox(ss)


        Dim pathArray = path.ToArray

        lcs(pathArray, cf, n, n)

        MsgBox(sss)

    End Sub


    Dim sss = ""

    Sub lcs(ByVal pathArray, ByVal cf, ByVal i, ByVal j)

        If i = 0 Or j = 0 Then

            Return

        ElseIf cf(i, j) = 3 Then

            lcs(pathArray, cf, i - 1, j - 1)

            sss = sss & pathArray(i - 1) & " "

        ElseIf cf(i, j) = 1 Then

            lcs(pathArray, cf, i - 1, j)

        Else

            lcs(pathArray, cf, i, j - 1)

        End If

    End Sub

End Class






2021年8月3日 星期二

羅馬數字 VB.Net

        

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim rd1 = "I(1)V(5)X(10)L(50)C(100)D(500)M(1000)"
        Dim sep = {"(", ")"}
        Dim rd = rd1.Split(sep, StringSplitOptions.RemoveEmptyEntries)
        Dim d1 As New Dictionary(Of String, Integer)
        For i = 0 To 12 Step 2
            d1.Add(rd(i), CInt(rd(i + 1)))
        Next
        Dim d2 As New Dictionary(Of String, Integer)
        d2.Add("IV", 4)
        d2.Add("IX", 9)
        d2.Add("XC", 90)
        d2.Add("XL", 40)
        d2.Add("CD", 400)
        d2.Add("CM", 900)

        Dim tstr = "IXCDM"
        Dim s = 0
        While tstr.Length > 0
            For Each ds In d2.Keys
                If InStr(tstr, ds) > 0 Then
                    s = s + d2(ds)
                    tstr = tstr.Substring(2)
                End If
            Next
            For Each ds In d1.Keys
                If InStr(tstr, ds) > 0 Then
                    s = s + d1(ds)
                    tstr = tstr.Substring(1)
                End If
            Next
        End While
        MsgBox(s)
        End
    End Sub
End Class

TreeView TreeNode VB.Net

 Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim t(100) As TreeNode


        Dim namedata = {"", "公司", "部門一", "部門二", "分部一", "分部二", "分部一", "分部二", "人員一", "人員二", "人員一", "人員二", "人員一", "人員二"}

        Dim rr(100) As String


        For dist = 0 To 40 Step 20

            For i = 1 + dist To 12 + dist

                rr(i) = namedata(i - dist)

            Next

        Next


        rr(1) = "公司一"

        rr(21) = "公司二"

        rr(41) = "公司三"

        For dist = 0 To 40 Step 20

            t(1 + dist) = TreeView1.Nodes.Add(rr(1 + dist))

            For i = 2 To 12

                t(i + dist) = t(i \ 2 + dist).Nodes.Add(rr(i + dist))

            Next

        Next

        TreeView1.ExpandAll()

    End Sub

End Class