Re: Want to get filename for images dragged from Finder and from Safari / Firefox
Re: Want to get filename for images dragged from Finder and from Safari / Firefox
- Subject: Re: Want to get filename for images dragged from Finder and from Safari / Firefox
- From: Bryan Prusha <email@hidden>
- Date: Wed, 17 Aug 2005 13:57:16 -0700
On Aug 17, 2005, at 12:47 PM, Adam Holt wrote:
I've got an NSImageView that I've subclassed in order to post a
notification
of the filename of any images that are dropped on it.
My problem is that:
[pboard stringForType:NSFilenamesPboardType]
only gives me filenames for locally dragged files (from Finder),
but I also
want to get a filename when I drag and drop in images from a browser.
I tried using [pboard stringForType:NSURLPboardType] instead, which
works
better, i.e. it gives me the local filename (in file:// form), and
gives me
the URL of images dragged from a browser EXCEPT when those images are
themselves links, in which case it gives me the URL that the image
is linked
to and not the URL of the image itself which is of course what I
need in
order to workout the filename.
Does anybody have a solution that could work for both local images
and web
images?
Safari supplies "Apple URL pasteboard type" and
"NSStringPboardType" that both contain the name of the file. The
image file appears to be provided as a "promised file" which is why
the NSFilenamesPboardType doesn't exist.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden