Autodesk-Forge / forge-php-client

Forge PHP SDK: Enables you to easily integrate the Forge REST APIs into your application, including OAuth, Data Management,Model Derivative, and Design Automation
Apache License 2.0
41 stars 52 forks source link

uploadObject method not working #10

Open augustogoncalves opened 6 years ago

augustogoncalves commented 6 years ago

It seems it's converting the body/file and causing error 504

luiztiago commented 6 years ago

We had this issue using the ObjectsApi#uploadObject method. The issue was related with line #137 on ApiClient file, trying to convert the body(file) to JSON.

hishamyounis commented 6 years ago

I encountered the same problem. The documentation specify passing the file path to the uploadObject() function. When you do this, it does not attempt to json_encode it in line 136, since it's a string, but the upload times out with a 504 response, since the specified payload size is bigger than the actual content sent. The work around I implemented was changing line #196 from: curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); to: curl_setopt($curl, CURLOPT_POSTFIELDS, file_get_contents($postData));

melledijkstra commented 6 years ago

When is this going to be fixed? It's a small patch right. Still having trouble with this!

I can make a pull request if needed, or is this problem bigger then that single line?

ido567 commented 6 years ago

Unfortunately, we are no longer maintaining this SDK. If you send a PR, we would be happy to merge it.

melledijkstra commented 6 years ago

@ido567 That's too bad, well I fixed it with https://github.com/cweagans/composer-patches (for others having this problem). If I have some time I will send a PR. Thanks anyway! ;)

tuimz commented 6 years ago

@MelleDijkstra If you are still using this ;)

It seems it is just the parameter suggestion in the docblock is wrong, uploadObject does not need a SplFileObject but just the file content is fine.

melledijkstra commented 6 years ago

@tuimz Ahh, so a patch wasn't actually needed just pass file_get_contents() straight into the function. well... the patch works anyways 😋. Thanks!

tuimz commented 6 years ago

Hi @augustogoncalves I have submitted a PR wich resolves this issue. Could you take a look?

JohnOnSoftware commented 6 years ago

@tuimz Thanks for your PRs, I will help Augusto to maintain the SDK, I am checking your PR but my access seems not enough to approve that, working on that now.

swalter88 commented 6 years ago

This bug is still present... I also had to insert following lines to get rid of a http 504 error:

curl_setopt($curl, CURLOPT_FORBID_REUSE, 1); curl_setopt($curl, CURLOPT_ENCODING , "");

Dshufeng commented 3 years ago

The 504 problem still occurs, how can I solve it?