I'm trying to build a service into my website to allow uploads to be saved to owncloud and then displayed.
As per this: Uploading files to an ownCloud server programatically
I was able to setup postman to upload files and successfully save to serve. Now how do I display those files or do a getrequest to display an image on my website?
I found the get command. You need to make sure you have the authorization header as in postman for example.
You could do a get call
<baseurl>/owncloud/remote.php/<user>/<folder>/<pathtofile>
if you click on authorization select normal then put in your credentials it will generate a token key for you, this should be a separate call itself to generate a unique one each time.
You can also create folders to upload to using the MKCOL request. I had to export my postman and edit the export to have the MKCOL request b/c they are not built in.
<baseurl>/owncloud/remote.php/<user>/<foldertocreate>
Related
On my website I let registered members create multiple profiles, each of these with their own avatar picture.
On the Create Profile page, I have this input to submit the avatar...
... and get it displayed on the Profile page:
How can I recreate the same, uploading one more picture from Create Profile and display it on Profile page?
I know where the source files for each page are located, but unfortunately I’m unable to recreate it..
Thanks.
You need a 3 step process to upload the image file, store it and send it to the front-end users.
If your app is an SPA and you don't want to reload the page in the user's browser, you'll need a JS process to read the file from a file button and send it to your server (through AJAX as a FormData object for example)
Then your server should be able to handle the formdata object request and read file content from it. Once done, you have to save it in a secure server-side location.
Finally (again in case of an SPA) your server should be able to answer the picture data when the client asks it
The server should be able to give the avatar's URL when asked by the client (with a Restful API for example)
The server should be able to give access to the image when the client uses the image's url
I have an app that runs in the client browser and doesn't have any server side (http/js is served, but nothing posts to the server). the app is redeployed on many servers (iis, apache, nginx, sometimes localhost, sometimes on an intranet) and are served using http (not https). My app generates files such as zip files and pdf's in the clients browser as blobs BEFORE I want to save, so having them navigate away on the same page then back to the app defeats the purpose; and I can't post the generated data to dropbox anymore, since they have to start over... I want to be able to send these blobs directly to files in the end users dropbox (and later google drive).
https://www.dropbox.com/developers-v1/dropins/saver performs exactly as I would like. It pops up. It lets the user authenticate in the popup. It lets the user choose where they want to put my file. But I can't send it a data uri, or base64-encoded data, or a bytearray, or whatever. It only works with files previously saved somewhere accessible on the net. So it does not work for me.
https://www.newfangled.com/direct-javascript-dropbox-api-usage/ shows how I could embed the oauth data, which I don't have.
https://blogs.dropbox.com/developers/2013/12/writing-a-file-with-the-dropbox-javascript-sdk/ seems like it should work, except that it's trying to perform an oauth session and it uses the same window as my app (which is undesired).
My current tabs I'm looking at (includes entries from a few years ago, so things might have since changed). Some articles indicate that it isn't possible. Other articles incidate that it IS possible - i mean this particular comment https://github.com/dropbox/dropbox-js/issues/144# doesn't help me much. Neither does "I'll be sure to pass this along as feedback" - was it passed along? To whom?
https://github.com/dropbox/dropbox-js/issues/144
https://stackoverflow.com/questions/30094403/save-input-text-to-dropbox
https://blogs.dropbox.com/developers/2015/06/programmatically-saving-a-url-to-dropbox/
How can I upload files to dropbox using JavaScript?
upload file to dropBox using /files_put javascript
https://github.com/morrishopkins/DropBox-Uploader/blob/master/js/reader.js
https://www.dropbox.com/developers/saver
https://www.dropboxforum.com/hc/en-us/community/posts/202339309-Can-I-save-a-JSON-stream-object-to-Dropbox-file-with-Dropbox-Post-Rest-API-
https://github.com/smarx/othw
Can Dropbox Saver accept data from createObjectURL()?
It sounds like the code from https://blogs.dropbox.com/developers/2013/12/writing-a-file-with-the-dropbox-javascript-sdk/ works fine for you, but you want to do the auth in a separate browser window/tab.
If so, I'd suggest just changing that code to use the Popup auth driver instead.
I'm writing a web page (using spring mvc) which displays a list of files that the user can download. I would like the 'save as' dialog to open when user choose a file and clicks the download button. To my best understanding, i can use href with the path to the file (or use window.location), however the files that should be downloaded are located in a different server and need to be fetched from there first.
There are two options that i have thought of, both have big flaws:
1. use window.location with a link to a spring mvc controller. in the controller make a call to fetch the file and set its content on the response (with content-disposition header).
The problem is that for large files, it will take some time for the save as dialog to open (As the file needs to be fetched from the remote server first) and i have no way of 'telling' the user that the download has started.
2. make an http call that will retrieve the file from the second server (and have some kind of indication while the http promise has not yet resolved), save it on my server, return the path to the file in the response and than call window.location with the returned path.
In this case, the downloaded files will need to somehow get deleted at the end of the download.
Any ideas and thoughts?
Thanks a lot!
I am having an issue that I cant solve in my head for some reason.
I have a client (Angular) and server (Node). They should run in same domain.
Idea is that when the user is logged in he can change his profile image and store it DB.
Angular client (which is SPA) is served by Apache, however Angular talks to Node.js which runs on different port, but they are running on the same instance.
So, user changes the image which is save on S3 and the link to the image is stored in users DB. When the user is logged in, his image will be shown on the page.
Is there a flow with this design?
In a simple chat example using an APE Server and JavaScript on the client side which is pushing/polling information, is it possible to allow one user to upload a file (for example an image) and make the other users see that uploaded image, all in real time?
Thanks.
Comet applications are generally used for text-based messaging. You could feasibly encode the image and send that data over the wire but the best practice would most likely be:
User uploads the image to the application using normal web app file upload functionality
Server receives the file, in addition to some instruction about telling other users about the file, and triggers and event information the other users that a new file is present. This event should also include the location of the file
The other users receive the update, access the file location and then display the new file in the application
If 3. were a web app then you could dynamically create a new image an set the src attribute on it e.g. <img src="path_to_new_image" />.