Hi guys, I'm making an app that needs to drag images from the browser into a picturebox inside my app, from which I will later save the image when needed. The problem is that, with the code I've got, it only works on Firefox, it doesn't work on chrome and opera, while IE seems to not support such a thing at all.
If anyone could suggest me anything, or a different method that would work on all browsers, or at least in chrome, I'd really appreciate it.
Here's my code for the drag and drop:
If anyone could suggest me anything, or a different method that would work on all browsers, or at least in chrome, I'd really appreciate it.
Here's my code for the drag and drop:
vb Code:
Public ImageFileStream As FileStream Private Sub PhotoPictureBox_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PhotoPictureBox.DragEnter If e.Data.GetDataPresent(DataFormats.FileDrop, False) Then Dim strFile() As String = CType(e.Data.GetData(DataFormats.FileDrop), String()) Dim fi As New System.IO.FileInfo(strFile(0)) If fi.Extension = ".gif" Or fi.Extension = ".bmp" Or fi.Extension = ".jpg" Or fi.Extension = ".jpeg" Or fi.Extension = ".png" Then e.Effect = DragDropEffects.Copy End If End If End Sub Private Sub PictureBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PhotoPictureBox.DragDrop Dim s() As String = CType(e.Data.GetData(DataFormats.FileDrop), String()) ImageFileStream = New FileStream(s(0), IO.FileMode.Open) Dim bm As New Bitmap(ImageFileStream) PhotoPictureBox.SizeMode = PictureBoxSizeMode.Zoom PhotoPictureBox.Image = bm End Sub