Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem uploading files #18

Open
smoscar opened this issue Mar 8, 2017 · 2 comments
Open

Problem uploading files #18

smoscar opened this issue Mar 8, 2017 · 2 comments

Comments

@smoscar
Copy link

smoscar commented Mar 8, 2017

The API request to upload files doesn't seem to be working, it creates the file on ActiveCollab but its size is always 0 bytes.

I am not sure if I am using the request correctly:

API::call( 'projects/1/files/files/upload', null, array(
'file[name]' => 'NAME OF THE FILE',
'file[visibility]' => 1,
'file[category_id]' => 1,
'file[body]' => 'FILE DESCRIPTION',
'file[milestone_id]' => 0,
'file[project_id]' => 1
), array(
'/ABSOLUTE_PATH/file.jpg'
));

Am I doing something wrong?

@smoscar
Copy link
Author

smoscar commented Mar 9, 2017

Or in other words, what variable is the API expecting for the attachment here:

curl -i
-H "Accept: application/json"
-H "Content-Type:multipart/form-data"
-X POST
-F "submitted=submitted"
-F "file[name]=NAME_OF_THE_FILE"
-F "file[visibility]=1"
-F "file[category_id]=1"
-F "file[body]=FILE_DESCRIPTION"
-F "file[milestone_id]=0"
-F "file[project_id]=1"
-F "attachment_1=@/ABSOLUTE_PATH/file.jpg;type=application/octet-stream"
"http://site.com/activecollab/api.php?path_info=projects/1/files/files/upload&auth_api_token=MY_API_TOKEN"

Thanks

@smoscar
Copy link
Author

smoscar commented Mar 19, 2017

It expects the argument "attachment"

Added a couple commits to fix this here:
https://github.com/smoscar/activecollab-sdk/commits/master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant