Comments (10)
I assume you mean "Browser Uploads to S3" directly (rather than going through your webserver), as outlined here.
Right now arc
does not facilitate this.
Let me think a bit about how an integration might look and if including it in this package vs a separate package would be best.
Thanks for your input!
from arc.
I have not started on this feature, and I likely won't have time to for a little while.
But I am open to including some of the core functionality in this package.
Namely:
- A straightforward way of generating the policy, signature, etc.
- A way to consume the uploaded file and run transformations.
In my head a workflow would look something like:
- Server creates an upload form using policy, signature, etc from Arc.
- Client uploads file directly to S3.
- Upon successful upload, client informs server that the upload has finished.
- Server instructs Arc to process transformations of the newly uploaded file.
I believe ExAws has all of the necessary logic to do this.
from arc.
Does this support using an http url instead of a file path to upload an image directly to s3?
from arc.
@Chowza I have a branch open which does this: #7
I haven't merged it since I'm not actually using it in production yet, and I might want to change it to be a little more explicit about remote vs. local retrieval. But you're welcome to try it and let me know your thoughts!
from arc.
Do you think the remote-files branch work with arc_ecto? Anything special required to make it work?
I am attempting to build a seed file... in mix.exs I have:
{:arc, git: "https://github.com/stavro/arc.git", branch: "remote-files", override: true},
And in my seed file:
path = ~s(http://www.isnorcreative.com/system/images/#{image.id}/original/#{image.file})
changeset = Gbiphoenix.ProjectImage.changeset(%Gbiphoenix.ProjectImage{}, %{project_id: project.id, image: path} )
Gbiphoenix.Repo.insert!(changeset)
I am getting a changeset error:
[image: "can't be blank"]
I have been looking poking around in arc and arc_ecto seeing if arc_ecto would need to be modified to make this work, but have yet to figure it out.
from arc.
@gordonbisnor Can I see your model and the changeset function you have defined?
from arc.
Yes this is it here:
defmodule Gbiphoenix.ProjectImage do
use Gbiphoenix.Web, :model
use Arc.Ecto.Model
schema "project_images" do
field :image, Gbiphoenix.Image.Type
belongs_to :project, Gbiphoenix.Project
timestamps
end
@required_fields ~w(project_id)
@optional_fields ~w()
@required_file_fields ~w(image)
@optional_file_fields ~w()
@doc """
Creates a changeset based on the `model` and `params`.
If no params are provided, an invalid changeset is returned
with no validation performed.
"""
def changeset(model, params \\ :empty) do
model
|> cast(params, @required_fields, @optional_fields)
|> cast_attachments(params, @required_file_fields, @optional_file_fields)
end
end
from arc.
@stavro It seems that my seed file is specifying params with atom keys rather than string keys, which then causes the Dict.take function to return empty as it is comparing the binary lists of ~w() optional_file_fields and required_file_fields with the atoms of my seed file params.
I have an arc-ecto fork with a remote-files branch where I convert the required ++ optional list to atoms which worked for me. I didn't do a pull request because I don't know exactly what's going on here – I'm new to Elixir. I also found that I needed to convert the maps in the model test file to use atom keys as well, I was getting 4 failing tests with string keys.
Now that I think of it, I must have created the broken tests in my fork by converting the keys to atoms.
from arc.
@stavro did you get the uploads pass-thru working? Is this a feature yet of Arc? If not, did you create a separate package providing this? I'd like to facilitate pass-thru upload and download of files.
Thanks
from arc.
Me too for pass-through - what is the status. It looks as the S3 libraries come with some sort of signing function (e.g. for node) which needs to be emulated? This code might already do it http://jhosteny.github.io/2015/06/10/elixir-clojurescript-s3-upload/
from arc.
Related Issues (20)
- Warnings during compilation on ELixir 1.8.0-otp-21.2.2
- Expires header is N/A when uploading to S3. HOT 1
- Arc: Uploading Protected Files HOT 3
- Test configuration, how to prevent HTTP requests?
- `arc` crashes when trying to delete a file with a `:skip`ped transform HOT 1
- Arc sometimes does not save files
- Validation when uploading from a remote URL
- Attachment not uploaded to S3 on create, only on update HOT 3
- Converting PDF to PNG - resulting images stuck in temporary file (multi-page pdf) HOT 4
- url/1 returns non existing files HOT 2
- Seperate store_filename from url_filename in definition HOT 2
- minio storage support HOT 1
- Object deletion by scope HOT 2
- MyApp.Avatar.url({filename, scope}) returns path with leading slash
- Change tmp %Arc.File{} path.
- Versions on the fly
- Does it work with Digital Ocean storage instead of AWS? HOT 1
- Local upload - (UndefinedFunctionError) function nil.id/0 is undefined HOT 2
- Getting Timeout error - Azure container upload
- ARC.File unpack/repack /APEX ENGINE
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arc.