如何在slim 3中上传图像文件?

时间:2016-11-24 11:21:45

标签: php android html slim

我必须使用slim 3在服务器上上传图像文件。我想保存表格中的文件路径和服务器上文件夹中的相应图像

 $filenamePath = md5(time().uniqid()).".jpg";
        $decoded=base64_decode($image);
        file_put_contents("images/".$filenamePath,$decoded);

        $sth = $this->db->prepare("UPDATE orders set status =:status,
                                      total_amount=:amount,created_at=:date1,receipt=:path WHERE id=:orderId");
        $sth->bindParam("orderId",$orderid );
        $sth->bindParam("status", $status);
        $sth->bindParam("amount", $amount);
        $sth->bindParam("date1", $date);
        $sth->bindParam("path", $filenamePath);
        $sth->execute();
  

这是我在苗条3级的代码   this is my directory stucture of folder on server   出了什么问题?任何人都可以帮忙吗?

2 个答案:

答案 0 :(得分:1)

尝试完整的图片路径

示例:

file_put_contents("/testslim/v1/src/images/".$filenamePath,$decoded);

答案 1 :(得分:1)

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Dim LastRow As Long
Dim PvtTbl  As PivotTable

' find last row in Column A that has a city
LastRow = Cells(Rows.Count, "A").End(xlUp).Row

' check if double-click was inside a range in Column A, where there is a city name
' starting from row 2, assuming the first row is the header row
If Not Intersect(Target, Range("A2:A" & LastRow)) Is Nothing Then
    Application.ScreenUpdating = False

    Set PvtTbl = Worksheets("Dillon Pivot").PivotTables("PivotTable2")

    With PvtTbl
        .ManualUpdate = True
        .PivotFields("Match").ClearAllFilters
        .PivotFields("Match").CurrentPage = Target.Value
        .ManualUpdate = False
    End With
    Application.ScreenUpdating = True
End If

End Sub

只需像上面的代码一样更改路径并获得图片文件夹的权限