You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Jinhui Du (JIRA)" <ji...@apache.org> on 2009/08/02 17:49:14 UTC

[jira] Created: (SHINDIG-1136) Content upload for php shindig

Content upload for php shindig
------------------------------

                 Key: SHINDIG-1136
                 URL: https://issues.apache.org/jira/browse/SHINDIG-1136
             Project: Shindig
          Issue Type: New Feature
          Components: PHP
         Environment: php 5.2.4
            Reporter: Jinhui Du


The URL for code review is http://codereview.appspot.com/98103/show

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SHINDIG-1136) Content upload for php shindig

Posted by "Chris Chabot (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Chabot resolved SHINDIG-1136.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1-BETA3
         Assignee: Chris Chabot

Most recent update to the codereview addressed all the issues that remained & has been committed.

Thanks!

> Content upload for php shindig
> ------------------------------
>
>                 Key: SHINDIG-1136
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1136
>             Project: Shindig
>          Issue Type: New Feature
>          Components: PHP
>         Environment: php 5.2.4
>            Reporter: Jinhui Du
>            Assignee: Chris Chabot
>             Fix For: 1.1-BETA3
>
>
> The URL for code review is http://codereview.appspot.com/98103/show

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1136) Content upload for php shindig

Posted by "Jinhui Du (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738295#action_12738295 ] 

Jinhui Du commented on SHINDIG-1136:
------------------------------------

Thanks for your comments.

- In the RPC method the Content-Type is multipart/form-data and both  php://input.and $HTTP_RAW_POST_DATA are not available. The json converter will work as the default converter. In the REST method if the Content-Type is set to multipart/form-data it works. I'm working on the case that the Content-Type is image/* audio/* or video/*.

- The container should take the responsibility to verify the uploaded files.  In Partuza reference implementation the uploaded file is firstly moved to the "albums" folder via the move_uploaded_file method as a temporary file then is read using the image library. Finally the content read by the image library is written into the albums folder and the temporary file is deleted. As there are only image libraries in the current code, only image is support now in partuza. 

- As php handles the multipart/form logic the container can easily access the uploaded files via the $_FILES global variable. We may not need to pass the content data to the container.

I'm working on the the content-type image/*, video/*, audio/* and making the createActivity in partuza supports content upload. I'll send out the CL later.



> Content upload for php shindig
> ------------------------------
>
>                 Key: SHINDIG-1136
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1136
>             Project: Shindig
>          Issue Type: New Feature
>          Components: PHP
>         Environment: php 5.2.4
>            Reporter: Jinhui Du
>
> The URL for code review is http://codereview.appspot.com/98103/show

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1136) Content upload for php shindig

Posted by "Chris Chabot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738276#action_12738276 ] 

Chris Chabot commented on SHINDIG-1136:
---------------------------------------

The code it's self looks alright, but there's a something that isn't quite clear to me on how it's intended to work:

- In the input converter you try to json_decode the post body, however a post with a media item attached should have a Content-Type: image/*, audio/* or video/* content type, so I would think the json input converter would never be called in the first place when it's a raw binary data media item upload.

- Instead I would expect something like 'If this is a POST to the media item url, and the content-type is image/*, audio/* or video/*, call the container's SPI implementation and ask it to validate and create a new media item, returning the ID to it'. (see the 'two step upload' in http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/REST-API.html#rfc.section.3.7)

- If the image/audio/video format is not accepted by the container (either because it's corrupted data, or because someone tried to upload something that isn't a valid image at all (think using it as a distribution method: uploading zip files but pretending they are images in the hope the container will host them for you), there should be a clear way for it to reject the upload. The Partuza reference implementation should def check on this as an example, if it only does images and rejects video & audio that's fine by me, just as long as implementers have the choice on what they want to support

- On a POST with a media item url, the container would probably want to have a local copy as well (performance, security by validating before accepting (see above), being able to generate thumbnails etc); Wouldn't it be easier for the implementers if we just fetched the data for them, and pretended it was a regular content upload? (with the content-type being the content-type that we recieved when fetching the remote content)

I'll commit what we have so far, but I hope you can either explain how the above already works, or address those issues

> Content upload for php shindig
> ------------------------------
>
>                 Key: SHINDIG-1136
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1136
>             Project: Shindig
>          Issue Type: New Feature
>          Components: PHP
>         Environment: php 5.2.4
>            Reporter: Jinhui Du
>
> The URL for code review is http://codereview.appspot.com/98103/show

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1136) Content upload for php shindig

Posted by "Jinhui Du (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741019#action_12741019 ] 

Jinhui Du commented on SHINDIG-1136:
------------------------------------

The patch has been changed according to your comments a couple of days ago. Please review them at  http://codereview.appspot.com/100041 and http://codereview.appspot.com/99052/show

> Content upload for php shindig
> ------------------------------
>
>                 Key: SHINDIG-1136
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1136
>             Project: Shindig
>          Issue Type: New Feature
>          Components: PHP
>         Environment: php 5.2.4
>            Reporter: Jinhui Du
>
> The URL for code review is http://codereview.appspot.com/98103/show

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1136) Content upload for php shindig

Posted by "Chris Chabot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738311#action_12738311 ] 

Chris Chabot commented on SHINDIG-1136:
---------------------------------------

If i understand the spec correctly, uploading to RPC is possible when using multipart/form-data, in which case the RPC json body should be in the 'request' field, and the binary data would be available through the $_FILES superglobal. I don't think we've actually implemented that 'request field' functionality yet? See http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/RPC-Protocol.html#rfc.section.13 in the RPC spec

Since uploading to the REST endpoint is basically a post with Content-Type: {image,video,audio}/* and the post body == the binary data, it seemed like a simpler design to me to always just hand off the binary data blob as a variable to the container's implementation, instead of counting on it to do move_uploaded_file, since in this situation there is no uploaded file, so the only way to make the REST and RPC posts with binary data attached to it consistent for the service layer, is to save the uploaded data to a new temporary file, and pass that file name + all the other data we know about the upload type to the SPI. That does mean the container will have to do it's own moving, but at least the container wouldn't have to worry about the incoming request format.

We could also just pass a $data containing all the binary info around, but with video uploading and all that, that would probably run out of memory way to quickly, so temp files seem to be a better way to go :)



> Content upload for php shindig
> ------------------------------
>
>                 Key: SHINDIG-1136
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1136
>             Project: Shindig
>          Issue Type: New Feature
>          Components: PHP
>         Environment: php 5.2.4
>            Reporter: Jinhui Du
>
> The URL for code review is http://codereview.appspot.com/98103/show

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1136) Content upload for php shindig

Posted by "Jinhui Du (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738322#action_12738322 ] 

Jinhui Du commented on SHINDIG-1136:
------------------------------------

The previous corresponding partuza implementation is at http://codereview.appspot.com/98106/show . 

> Content upload for php shindig
> ------------------------------
>
>                 Key: SHINDIG-1136
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1136
>             Project: Shindig
>          Issue Type: New Feature
>          Components: PHP
>         Environment: php 5.2.4
>            Reporter: Jinhui Du
>
> The URL for code review is http://codereview.appspot.com/98103/show

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.