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

📚 Documentation: update file with content #11

Open
2 tasks done
jenniestrongbow opened this issue Dec 19, 2021 · 8 comments
Open
2 tasks done

📚 Documentation: update file with content #11

jenniestrongbow opened this issue Dec 19, 2021 · 8 comments

Comments

@jenniestrongbow
Copy link

💭 Description

Hi, after reading your documentation, I could not figure out how to update a file I created earlier with new content. Please help. Thanks

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@eldadfux
Copy link
Member

You can only update the file permissions like this:

<?php

use Appwrite\Client;
use Appwrite\Services\Storage;

$client = new Client();

$client
    ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
    ->setProject('5df5acd0d48c2') // Your project ID
    ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;

$storage = new Storage($client);

$result = $storage->updateFile('[FILE_ID]', [], []);

For what you're trying to achieve, you have to delete the old file, and create a new one.

@eldadfux
Copy link
Member

@jenniestrongbow
Copy link
Author

jenniestrongbow commented Dec 30, 2021

Ok, thanks, I saw that page. But It din't make sense to me as you can't upload a file to the file with the same ID.

@jenniestrongbow
Copy link
Author

I saw in your example that you entered https://[HOSTNAME_OR_IP]/v1. How do I get https to work with my IP? Should I install certbot? In my experience, it only works with Apache? Which I don't want to use as my 80/443 ports are used by my appwrite. Thanks

@Meldiron
Copy link
Contributor

Ok, thanks, I saw that page. But It didn't make sense to me as you can't upload a file to the file with the same ID.

That is true, the ID will be different. You will have to update your database and set the new ID there. In future, we plan to support Custom IDs that will allow you to set anything as an ID - this will allow you to create a new file with the same ID.

@Meldiron
Copy link
Contributor

I saw in your example that you entered https://[HOSTNAME_OR_IP]/v1. How do I get https to work with my IP? Should I install certbot? In my experience, it only works with Apache? Which I don't want to use as my 80/443 ports are used by my appwrite. Thanks

You could generate custom certificates for your IP address manually (self-signed), but I am not sure how secure that is - browsers might still complain. I recommend you get a domain and set up HTTPS on the domain name.

Let's Encrypt (tool Appwrite uses) issues domain-validated certificates. The certificates must be attached to at least a domain name.

@kiloki-official
Copy link

Hi meldiron, thanks for your feedback. I upgraded to version 0.12, so I'll test and see if we can now use custom IDs.

Re. HTTPS, I used Let's Encrypt with a specific domain. Thanks

@lohanidamodar
Copy link
Member

@Meldiron is this still relevant? If not please close this.

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

5 participants