upload json file and process it

73 views
Skip to first unread message

saptah

unread,
May 19, 2012, 11:53:05 AM5/19/12
to cherryp...@googlegroups.com
Hi guys,
I'm starting a new project, and I'm using cherrypy for a backend.

One thing though, I'm trying to do an upload of a json file, and I'd like to process this json file 'on the fly' without needing to access the physical file on disk. ¿is this possible?

Thanks!!

Eugene Van den Bulke

unread,
May 20, 2012, 4:42:16 PM5/20/12
to cherryp...@googlegroups.com
"When a client uploads a file to a CherryPy application, it’s placed
on disk immediately."

http://docs.cherrypy.org/stable/progguide/files/uploading.html

So the answer is no BUT if you meant that you didn't want to have to
think about saving the file to disk etc. the answer is yes because CP
does it for you so in your upload(file_) method you could probably get
away with json.load(file_.file) if not json.loads(file_.file.read())

OTH

Cheers,

--
EuGeNe -- follow me http://twitter.com/3kwa

Jeff Garbers

unread,
May 20, 2012, 5:27:03 PM5/20/12
to cherryp...@googlegroups.com
On May 19, 2012, at 11:53 AM, saptah wrote:

> One thing though, I'm trying to do an upload of a json file, and I'd like to process this json file 'on the fly' without needing to access the physical file on disk. ¿is this possible?


Are you doing the JSON file upload by having the user pick some existing JSON file off his local drive, or are you generating and POSTing the JSON from your JavaScript code?


Reply all
Reply to author
Forward
0 new messages