Jump to content

Welcome! You're currently a Guest.

If you'd like to join in the Discussion, or access additional features in our forums, please sign in with your Evernote Account here. Have an Evernote Account but forgot your password? Reset it! Don't have an account yet? Create One! You'll need to set your Display Name before your first post.

Photo

Add files on the user's local hard disk to a new Note?

help

  • Please log in to reply
6 replies to this topic

#1 roschler

roschler

  • PipPipPipPipPip
  • Title: Browncoat
  • Group: Members
  • 545 posts

Posted 19 June 2012 - 01:10 AM

In this document:

http://dev.evernote....ating_notes.php

They show how to create an image attachment to a new Evernote note. The example shown uses a file local to the web server. I have a desktop app that creates a local file (a movie) and then opens a browser window to do its work using the Evernote (cloud) API. That window navigates to the URL that does the OAuth step and then control is passed to the PHP script that creates the new note.

Given the scenario, what is the correct sequence to get the movie file on the user's local PC into the Evernote note? I will pass the full path to the file (e.g. - C:\movies\newmovie.avi) to the PHP script when I open the browser window. From that PHP script that builds the Evernote Note and stores it, Is it as simple as passing the file path like this?:

$resource->attributes->fileName = 'C:\movies\newmovie.avi';

Or do I have to prepend the URL with the 'file://' prefix like this?:

$resource->attributes->fileName = 'file://C:\movies\newmovie.avi';

Or (hopefully not) do I have to upload the file to my web server first and then pass the path to that file on the web server to $resource->attributes->fileName? I know I need to send a createNote() API request with the data as part of a Note resource structure:

http://dev.evernote....Struct_Resource

But I'm wondering what is the best method to do that. I am concerned about embedding a 5 to 10 MB chunk of data in a resource structure and making an Evernote API createNote() call with it. I was wondering if there was a way to get the data directly from the user's PC to the Evernote servers in a more direct manner, something akin to an FTP upload for example, that does not involve first uploading the file to an intermediary web server before making the createNote() call that aggregates the uploaded file in a big resource data structure.

-- roschler
BitQwik - Search your Evernote notes with a powerful Artificially Intelligent assistant!
TagHunter - The free intelligent power search tool for Windows Evernote users that have lots of Tags

#2 Julien Boedec

Julien Boedec

  • Title: Browncoat
  • Group: Evernote Employee
  • 407 posts

Posted 19 June 2012 - 04:11 PM

Here is a sample code that creates a note and uploads a file in php.

#3 roschler

roschler

  • PipPipPipPipPip
  • Title: Browncoat
  • Group: Members
  • 545 posts

Posted 19 June 2012 - 04:33 PM

@JulienBoedec,

That example does an fread() from a file local to the web server. I am trying to avoid that because that implies having to upload the file via FTP or a large POST operation to my web server before creating the note so it can be accessed as a local file by fread(), or one of the other PHP open/read calls, when I the API's createNote(). I'd like to find a way to get a large attachment to the Evernote servers by accessing a file directly that exists on the users local PC, not on my web server. For example, the Evernote Windows client must be doing something like that when doing a Sync operation if it finds a Note on the user's local Note store that has attachments. I'm hoping there are facilities in the Cloud API that might help me do the same.

-- roschler
BitQwik - Search your Evernote notes with a powerful Artificially Intelligent assistant!
TagHunter - The free intelligent power search tool for Windows Evernote users that have lots of Tags

#4 Julien Boedec

Julien Boedec

  • Title: Browncoat
  • Group: Evernote Employee
  • 407 posts

Posted 19 June 2012 - 08:13 PM

The only way to send a file is by using CreateNote or UpdateNote and therefore attaching the binary content of the file to the note's structure. In your case, you will have to to send it to your server.

#5 roschler

roschler

  • PipPipPipPipPip
  • Title: Browncoat
  • Group: Members
  • 545 posts

Posted 19 June 2012 - 08:20 PM

Ok thanks Julien. If you've got a suggestion box I'd love to see an addition to the API that allows for some form of direct transfer to the Evernote servers. Entities like the Web Clipper or the Windows/Mac native clients do it so there must be some currently private method for doing that. If there was a way for 3rd parties like myself to do it that would be great. An app that deals with large files that has to funnel everything through a single server could create a pretty hefty bandwidth bill if it really became popular and that could make the app untenable as a free or freemium app.
BitQwik - Search your Evernote notes with a powerful Artificially Intelligent assistant!
TagHunter - The free intelligent power search tool for Windows Evernote users that have lots of Tags

#6 AndyDent

AndyDent

  • PipPipPip
  • Title: Bushwhacker
  • Group: Members
  • 136 posts

Posted 20 June 2012 - 03:15 AM

Do any of the web clippers transfer files from the local disk? I thought they only sent data from the page selected, presumably grabbed direct from the DOM by Javascript.

Julien has already made the point about how to attach binary content. That's how the Evernote official desktop clients do file "transfer".

#7 roschler

roschler

  • PipPipPipPipPip
  • Title: Browncoat
  • Group: Members
  • 545 posts

Posted 20 June 2012 - 03:28 AM

@AndyDent,

Do any of the web clippers transfer files from the local disk? I thought they only sent data from the page selected, presumably grabbed direct from the DOM by Javascript.



I wasn't implying that the Web Clipper transfers local disk files. Just that it has a way to upload large data blocks to the Evernote servers directly.

Julien has already made the point about how to attach binary content. That's how the Evernote official desktop clients do file "transfer".


Are you saying that they upload the files to a separate Evernote web server before transferring them to Evernote instead of doing a direct POST or potentially an FTP or similar operation? Then if so, I'd like to see the API expanded to allow API consumers to use those servers too instead of having to run lots of a content through a potentially lightweight web server in preparation of note creation and delivery. As I said, if an application really took off the bandwidth bill could make being free or freemium untenable fast. This is an assumption on my part but you're essentially doing the same thing when you create a new Note in the Windows client and allow the next Sync operation to ferry the Note data to the Evernote web servers. It's just indirect and not available to apps that are using the Cloud API solely.

-- roschler
BitQwik - Search your Evernote notes with a powerful Artificially Intelligent assistant!
TagHunter - The free intelligent power search tool for Windows Evernote users that have lots of Tags





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Clip to Evernote