Coldfusion upload via API Wrapper

25 views
Skip to first unread message

ozatomic

unread,
Jun 18, 2009, 8:28:13 PM6/18/09
to SlideShare Developers
I've started working on a wrapper class to interact with the
slideshare api and I'm up to the upload slideshare stage.

The problem I'm have is that every time i attempt to POST the
slideshow files tot he API i get the response "6: Slideshow file is
not a source object"

<cfhttp url="#url#" result="result" timeout="#variables.timeout#"
method="POST" multipart="yes" multiparttype="related" >

| --- All Other Required parameters here --- |

<cfhttpparam type="file" name="slideshow_srcfile" file="#StructFind
(parameters, 'slideshow_srcfile')#" />
</cfhttp>


I've tried suing it with and without multiparttype thinking that it
might have to work the same way as the youtube API does but this does
not work i'm wondering if anyone else has had and luck?

sri prasanna

unread,
Jun 19, 2009, 3:23:05 AM6/19/09
to slideshare...@googlegroups.com
Hey,

Upload for me is working with PHP & HTML. I have attached the file. Hope this helps.

Regards,
Sri Prasanna. K
Blog: http://sprasanna.com
upload.php

ozatomic

unread,
Jun 21, 2009, 7:01:43 PM6/21/09
to SlideShare Developers
This doesn't really help me.
You file is just using the form directly and submitting it directly to
slideshare.

I am posting it to a local file and submitting it via cfhttp so that i
can capture the xml response and use other classes at the same time.

On Jun 19, 5:23 pm, sri prasanna <macho...@gmail.com> wrote:
> Hey,
>
> Upload for me is working with PHP & HTML. I have attached the file. Hope
> this helps.
>
> Regards,
> Sri Prasanna. K
> Blog:http://sprasanna.com
>
> On Fri, Jun 19, 2009 at 5:58 AM, ozatomic <ozato...@gmail.com> wrote:
>
> > I've started working on a wrapper class to interact with the
> > slideshare api and I'm up to the upload slideshare stage.
>
> > The problem I'm have is that every time i attempt to POST the
> > slideshow files tot he API i get the response "6: Slideshow file is
> > not a source object"
>
> > <cfhttp url="#url#" result="result" timeout="#variables.timeout#"
> > method="POST" multipart="yes" multiparttype="related" >
>
> > | --- All Other Required parameters here --- |
>
> > <cfhttpparam type="file" name="slideshow_srcfile" file="#StructFind
> > (parameters, 'slideshow_srcfile')#" />
> > </cfhttp>
>
> > I've tried suing it with and without multiparttype thinking that it
> > might have to work the same way as the youtube API does but this does
> > not work i'm wondering if anyone else has had and luck?
>
>
>
>  upload.php
> 1KViewDownload

Raymond Camden

unread,
Jun 21, 2009, 9:19:06 PM6/21/09
to slideshare...@googlegroups.com
Are you sure parameters.slideshow_srcfile is a valid file path? Also, not that it matters, but I'd skip the structFind stuff. Just do

file="#parameters.slideshow_srcfile#"
--
===========================================================================
Raymond Camden, ColdFusion Jedi Master

Email    : r...@camdenfamily.com
Blog      : www.coldfusionjedi.com
AOL IM : cfjedimaster

Keep up to date with the community: http://www.coldfusionbloggers.org

sri prasanna

unread,
Jun 22, 2009, 12:33:09 AM6/22/09
to slideshare...@googlegroups.com
@Raymond
    Thanks for the reply Raymond.

@ozatomic
    Did Raymond's suggestion work for you? If you could write down that it would be helpful for other devs.

Regards,
Sri Prasanna. K
Blog: http://sprasanna.com



ozatomic

unread,
Jun 22, 2009, 2:26:16 AM6/22/09
to SlideShare Developers
yeah i'm sure that it has a valid file path as it is refering to the
tempary uploaded file from my form. parameters.slideshow_srcfile is
form.slideshow_srcfile i'm jsut running some validation over things
and passing it around my class.

But when i do a cfdump on parameters it is pointing to a tmp file but
i can't acecss the file because it deletes the file after the script
has been run.
I know it works because I've ripped the cfhttp stuff out of my youtube
class and edited ti to suit.

sri prasanna

unread,
Jun 22, 2009, 2:38:36 AM6/22/09
to slideshare...@googlegroups.com
Hi,

If you could pastie your code I can check it out for you.

Regards,
Sri Prasanna. K
Blog: http://sprasanna.com



Brenton Bull

unread,
Jun 22, 2009, 2:53:19 AM6/22/09
to slideshare...@googlegroups.com
I've already pasted the code in the first post which contains everything you need.
But if you must know the rest here is a rundown of the sections.

-- HTML CODE --
<label>File:</label> <input type="file" name="slide" id="slide" />

-- On Post (This sticks it into a Show object which contains all the details about the show. --
<cfset variables.slideshareshow = CreateObject("component", "SlideShareShow").init() />
<cfset variables.slideshareshow.setSrcfile(Form.slide) />

-- Then we call the wrapper passing the api and secret and then tell ti to upload passing it a user object and a show object --
<cfset variables.slideshare = CreateObject("component", "_gcl.SlideShare").init("APIKEY", "SECRET") />
<cfif variables.slideshare.uploadSlideShow(variables.slideshareuser, variables.slideshareshow)>

-- From Here i set the requiered fields for the requiered action --
<cfset StructInsert(parameters, "slideshow_srcfile", slideshareshow.getSrcfile()) />

-- Then i run the request --

<cfhttp url="#url#" result="result" timeout="#variables.timeout#" method="POST" multipart="yes" multiparttype="related" >
    || -- All The Other Fields -- ||

    <cfhttpparam type="file" name="slideshow_srcfile" file="#StructFind
(parameters, 'slideshow_srcfile')#" />
</cfhttp>

And there is a reason i'm suing the StructFind raymond as i'm looping over parameters i normally have key where 'slideshow_srcfile' is. But it was easyer just to show it liek this for example both ways will work.

Raymond Camden

unread,
Jun 22, 2009, 4:48:41 PM6/22/09
to slideshare...@googlegroups.com
You said the file was a tmp file? Is it a file upload? Try processing
it first with cffile/action=upload. Move the file to someplace outside
of the OS temp dir as that may be part of the problem.


On Mon, Jun 22, 2009 at 1:53 AM, Brenton Bull<ozat...@gmail.com> wrote:
> I've already pasted the code in the first post which contains everything you
> need.
> But if you must know the rest here is a rundown of the sections.
>
> -- HTML CODE --
> <label>File:</label> <input type="file" name="slide" id="slide" />
>
> -- On Post (This sticks it into a Show object which contains all the details
> about the show. --
> <cfset variables.slideshareshow = CreateObject("component",
> "SlideShareShow").init() />
> <cfset variables.slideshareshow.setSrcfile(Form.slide) />
>


--

Reply all
Reply to author
Forward
0 new messages