Can I upload pic by url directly?

Topics: Developer Forum
Aug 14, 2010 at 7:17 PM

Can I use Flickr.UploadPicture("http://myurl");??

If not, please tell me how to do it work.

ps. I used GetResponseStream() method read to bytes[].

- convert back to MemoryStream

- and pass MemoryStream to Flickr.UploadPicture

but it's show "FlickrNet.FlickrApiException: Filetype was not recognised (5)".

Coordinator
Aug 16, 2010 at 8:54 AM
Why convert the stream returned by GetResponseStream into bytes and
then back into a stream - just pass it straight to UploadPicture.

Stream s = response.GetResponseStream();

string photoId = flickr.UploadPicture(s, "image.jpg", "Title",
"Description", ....);

As for the Filetype not recognised - what are you trying to upload,
and what did you pass as the filename?

Sam
Aug 16, 2010 at 9:39 PM

becuase GetResponseStream can't Seek.

Coordinator
Aug 17, 2010 at 11:09 AM
Good point.

I'll consider changing the code so it works on a none-seekable stream.

As for the original error - what type of file are you trying to upload? Is it a video or a photo?

Sam
Aug 17, 2010 at 12:00 PM

when i used GetResponseStream(), it shows "System.NotSupportedException: This stream does not support seek operations."

Please show me your code.

My upload file is a photo.

 

Thank you.

 

Coordinator
Aug 17, 2010 at 12:28 PM
Are you resetting the position on the MemoryStream to zero before uploading?

What type of photo are you trying to upload? JPG, PNG, TIFF, BMP?
Coordinator
Sep 15, 2010 at 4:40 PM
The latest version will not work with non-seekable streams. Hope this helps.

Sam