Foxtable(狐表)用户栏目专家坐堂 → 手机端上传文件能控制大小吗?


  共有264人关注过本帖树形打印复制链接

主题:手机端上传文件能控制大小吗?

帅哥哟,离线,有人找我吗?
jjun2002cn
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:146 积分:1498 威望:0 精华:0 注册:2016/11/8 7:15:00
手机端上传文件能控制大小吗?  发帖心情 Post By:2024/3/17 11:11:00 [只看该作者]

Case "sale.htm"
        Dim sb As New StringBuilder
        Dim a As String
        If e.Values("SaleID") IsNot nothing Then
   
            DataTables("Sale_List").LoadFilter = "SaleID = " & e.Values("SaleID") & " and AccountID = 1"
            DataTables("Sale_List").Load
            
            If DataTables("Sale_List").DataRows.Count > 0 Then
                '遍历销售单明细! 
                
                If Tables("Sale_List").Current("MainMemo").Contains("发货") Then
                    sb.AppendLine("<meta name='viewport' c>")
                    sb.AppendLine("<body >")
                    
                    sb.AppendLine("<table border= '1' >")
                    sb.AppendLine ("<TR style='text-align:center'>")
                    sb.AppendLine ("<TD>单号</TD>")
                    sb.AppendLine ("<TD>产品名称</TD>")
                    sb.AppendLine ("<TD>数量</TD>")
                    
                    sb.AppendLine ("</TR>")
                    
                    
                    Dim memo As String
                    For Each B As DataRow In DataTables("Sale_List").DataRows
                        sb.AppendLine ("<TR>")
                        sb.AppendLine ("<TD>" & B("SaleID") & "</TD>")
                        sb.AppendLine ("<TD>" & B("ProductName") & "</TD>")
                        sb.AppendLine ("<TD>" & B("ProductNumber") & "</TD>")
                        memo = memo & B("MainMemoEx")
                        sb.AppendLine ("</TR>")
                    Next
                    sb.AppendLine ( "<TR><td colspan ='3'>发货信息:" & memo & "</td></TR>")
                    sb.AppendLine("</table>")
                    'sb.AppendLine("<table border= '1' >")
                    'sb.AppendLine ( "<TR><td>" & memo & "</td></TR>")
                    'sb.AppendLine("</table>")
                    If Tables("Sale_List").Current("MainMemo").Contains("已经上传底单发货") Then
                        sb.AppendLine ( "<TR><td>")
                        sb.AppendLine("<img src= '" & "./uploadfiles/" & Tables("Sale_List").Current("SaleID") & ".jpg' width='200' height='200'></td></tr>")
                    Else
                        sb.appendLine("<form enctype='multipart/form-data' action='accept.htm' method='post' id='form1' name='form1'>")
                        sb.appendLine("单文件上传: <input type='file' name='up1' id='up1'><br/><br/>")
                        sb.appendLine("<input Type='submit' name='Sumbit' id='Sumbit' value='确定'>")
                        sb.appendLine("</form>")
                    End If 
                    sb.AppendLine("</body>")
                    e.WriteString(sb.ToString)
                Else
                    
                    sb.AppendLine("<meta name='viewport' c>")
                    sb.AppendLine("<p>还未发货!</p>")
                    e.WriteString(sb.ToString)
                End If 
                
                
            End If
        Else
            e.WriteString("<meta name='viewport' c><body>缺少单号!</body>")
        End If 


Case "accept.htm"
        Dim sb As New StringBuilder
        sb.AppendLine("<meta name='viewport' c>")
        sb.AppendLine("<table border='1'>")
        sb.AppendLine("<tr><td>")
        For Each key As String In e.Files.Keys
            
            sb.AppendLine("已经上传" & e.Files(key).Count & "个文件!</br>")
            For Each fl As String In e.Files(key)
                sb.AppendLine(Tables("Sale_List").Current("SaleID") & ".jpg" & "<br>")
                e.SaveFile(key, fl, "d:\web\uploadfiles\" & Tables("Sale_List").Current("SaleID") & ".jpg") '保存接收到的文件
                Dim ftp1 As New FtpClient
                ftp1.Host = "***"
                ftp1.Account = "**"
                ftp1.Password = "W**E"
                ftp1.Port = "**8"
                Dim temppath As String
                temppath = "/oldcloud/公共文档/货运底单/2018货运底单/" & Date.Today.Year & "-" & Date.Today.Month & "/" & Date.Today
                
                If ftp1.FileExists(temppath) Then
                    ' MessageBox.Show("文件夹存在")
                Else
                    ftp1.MakeDir(temppath)
                    'MessageBox.Show(temppath & "文件夹已经建好!")
                End If 
                
                If ftp1.Upload("d:\web\uploadfiles\" & Tables("Sale_List").Current("SaleID") & ".jpg", temppath & "/" & Tables("Sale_List").Current("SaleID") & ".jpg") Then
                    'MessageBox.Show("上传 OK!")
                Else
                    'MessageBox.Show("失败!")
                End If
                ftp1.Close
                
                DataTables("销售单数据").LoadFilter = "[SaleID] = " & Tables("Sale_List").Current("SaleID")
                DataTables("销售单数据").Load
                
                If Tables("销售单数据").Rows.Count > 0 Then
                    Tables("销售单数据").Current("SalePic") = temppath & "/" & Tables("Sale_List").Current("SaleID") & ".jpg"
                    Tables("销售单数据").Save()
                    'MessageBox.Show("老数据更新")
                Else
                    
                    Dim dr As DataRow
                    dr = DataTables("销售单数据").AddNew()
                    dr("AccountID") = 1
                    dr("SaleID") = Tables("Sale_List").Current("SaleID")
                    dr("SaleDate") = Tables("Sale_List").Current("SaleDate")
                    dr("SalePic") = temppath & "/" & Tables("Sale_List").Current("SaleID") & ".jpg"
                    'MessageBox.Show("新建文件")
                    DataTables("销售单数据").Save()
                End If 
                
            Next
            
            sb.AppendLine("<tr><td>")
        Next
        Dim temppath1 As String
        temppath1 = "/oldcloud/公共文档/货运底单/2018货运底单/" & Date.Today.Year & "-" & Date.Today.Month & "/" & Date.Today
        
        sb.AppendLine("<tr><td>")
        sb.AppendLine("以上文件服务器已正确接收并保存!</td></tr>")
        sb.AppendLine("<tr><td>")
        sb.AppendLine("<img src= '" & "./uploadfiles" & "/" & Tables("Sale_List").Current("SaleID") & ".jpg' width='200' height='200'></td></tr>")
        sb.AppendLine("</table>")
        Tables("sale").Filter = "[SaleID] = " & Tables("Sale_List").Current("SaleID")
        Tables("Sale").Current("MainMemo") = "已经上传底单发货"
        For Each row1 As DataRow In DataTables("Sale_List").DataRows
            row1("MainMemo") = "已经上传底单发货"
            
        Next 
        
        e.WriteString(sb.ToString)
        

通过手机传的文件太大了,能不能在手机端先判断一下大小或者调整一下大小再上传?
现在的情况是能上传就是很容易就卡死了!

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106132 积分:539771 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/17 20:46:00 [只看该作者]

参考:http://www.foxtable.com/mobilehelp/topics/0251.htm

 回到顶部