Upload Failing inside form and/or from url params


#1

I’m having an issue getting the upload to work using the shortcode when its on a page that includes a parameter in the url. I’m not sure if the cause at this point is the params in the url or inside the form where I’ve placed the shortcode.

The upload works fine on the /media/ tab in buddypress.

I’ve added the short code to a form, as described above. I’ve noticed the following differences from comparing console post and gets.

The failed post url is:

/edit-form/?post=1145/upload/

It appears that to post response is returning the page html of /edit-form/ instead of the /media/ json response.

The working url:

xxxxxxxxxxxxxxxx/[Member_Name]/upload/

The response given is the json response:

{“media_id”:“7”,“activity_id”:7,“redirect_url”:"",“permalink”:“http://xxxxxxxxxxxxxx/members/TestUser/media/7/",“cover_art”:"http://xxxxxxxxxxxxxx/wp-content/uploads/rtMedia/users/1/2015/08/bobs1-150x150.jpg”}

I’ve tried updating permalinks; including setting to default and back.

I’ve also tried removing the /?post=xxxx/ using fiebug as a test (from within rtmedia hidden vars, as well as the browser url). This was done without a page refresh - so obviously was not effective. But worth a shot to see.

All post data looks correct, other than the referer - this is the only difference I see.

Not really sure where to take it from here - other than looking through the rt source and trying to find a method to handle the params and/or ignore them.

Thoughts or has anyone else experienced this?


#2

I was able to access the same page without the param set in the url (lossing some functionality on my form…) and the uploader indeed uploads correctly.

How can I modify to ignore a url param in the referer

Thanks.


#3

I have been able to get the uploader to work by defining the shortcode params.

The gallery however will not load the new images and this IS do to the url param in the referer.

Editing the following line will correct the issue:

/buddypress-media/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php

Original: Line: 50 $url = trailingslashit ($_SERVER[‘REQUEST_URI’] );

Replace: Line: 50 $clean_uri = explode(’?’, $_SERVER[‘REQUEST_URI’], 2); $url = trailingslashit ( $clean_uri[0] );

Hope this helps someone else.


#4