我試圖讓圖片上傳工作。到目前爲止,我有這樣的:如何獲取圖像的路徑並修剪它?
Dim dlg As New OpenFileDialog
Dim strPath As String = ""
dlg.Filter = "PNG(*.png;)|*.png;"
dlg.ShowDialog()
Dim fileName As String = dlg.FileName.Trim
Dim ftpDirectory As String = ""
If fileName <> "" Then
If fileName.Contains("[") AndAlso fileName.Contains("].png") Then
MessageBox.Show("The file you have selected is on the FTP", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
strPath = dlg.FileName.ToString
End If
If button = 1 Then
txtSmallDealOneImg.Text = strPath
然而,strPath的返回整個路徑的圖像文件,例如C:/website/Images/page1/photo1.png
如何調整輸出,使其只顯示/Images/Page1/photo1.png?
的圖像是在不同的文件夾,這樣我就需要修剪的一切多數民衆贊成其次/圖像
如果圖像不同文件夾ei。 D:/ Other/Images,有沒有什麼辦法讓它更通用,例如在/ iamges – user3845868 2014-10-02 10:29:29
@ user3845868之前修剪任何東西:你沒有在你的問題中提到過,是嗎?什麼是規則,邏輯是什麼?你想從'Images/...'開始的一切嗎? – 2014-10-02 10:30:55
問題被編輯 – 2014-10-02 10:32:35