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

multipart_uploader_form rails helper #15

Open
DivyaNyros opened this issue Feb 4, 2014 · 20 comments
Open

multipart_uploader_form rails helper #15

DivyaNyros opened this issue Feb 4, 2014 · 20 comments

Comments

@DivyaNyros
Copy link

I used the form helper found on the readme in my rhtml . But while executing this in browser it was throwing as " undefined method `join' for nil:NilClass " .

Can any one please help me how to solve this issue .

@JahangerGull
Copy link

same is happening for me, any finding/luck over it ?

@JahangerGull
Copy link

the form helper options is expecting :types key which has not been passed

def multipart_uploader_form(options = {})
uploader_digest = S3Multipart::Uploader.serialize(options[:uploader])
html = file_field_tag options[:input_name], :accept => options[:types].join(','), :multiple => 'multiple', :data => {:uploader => uploader_digest}

Thanks

@lymecca
Copy link

lymecca commented May 2, 2014

same for me too, any update to solve it?

@JahangerGull
Copy link

Yes I have forked and patched the gem for my need. There are other issues as well so also make them fix like a real big file of some gigs will never get loaded because of pre signed urls x-amz-date is more then 15 mins for higher parts when they started to upload.

Thanks

Sent from my iPhone

On May 2, 2014, at 9:53 PM, lymecca [email protected] wrote:

same for me too, any update to solve it?


Reply to this email directly or view it on GitHub.

@lymecca
Copy link

lymecca commented May 2, 2014

Thanks for the reply JahangerGull !

I'm nb in github.... How should I proceed to test your forked on my dev app, instead of maxgillett master branch?

@JahangerGull
Copy link

You can use following in your Gemfile, as i am also using below line.

gem 's3_multipart', :git => "https://github.com/JahangerGull/s3_multipart.git", :branch => 'dev'

Still there are some pause issues that are in progress and will be completed in couple of days, once done then you may need to change :branch point to :master as its on :dev at the moment.

Thanks

@lymecca
Copy link

lymecca commented May 3, 2014

Tks JahangerGull,

nothing happening when I select files to upload, let me see what's happening...

... I'm going crazy trying to make this gem work on my project. Do you know if there is a sample application with this gem configured?

@edgji
Copy link

edgji commented May 8, 2014

I believe the readme is just off in documenting how to properly use the helper. It looks like the helper method requires an additional param that lists the types. This seems to work albeit a bit repetitive:

<%= multipart_uploader_form(input_name: 'uploader',
                            uploader: 'VideoUploader',
                            types: [".wmv", ".avi", ".mp4", ".mkv", ".mov", ".mpeg"],
                            button_class: 'submit-button',
                            button_text: 'Upload selected videos',
                            html: %Q{<button class="upload-button">Select videos</button>}) %>

alternatively I guess you could do

types: ["video/*"]

@JohnSmall
Copy link

" Do you know if there is a sample application with this gem configured?" I'll add a +1 vote for that. The instructions in 'Getting Started' don't work.

If anyone has a working application out of this gem, please could you post it so we can see it.

@JahangerGull
Copy link

Well don't have any idea that there is any public app at the moment or not,
though i am able to configure this gem with couple of patches. Can you tell
me where u have been stuck may able to help you ?

Thanks

On Tue, May 13, 2014 at 4:51 PM, John Small [email protected]:

" Do you know if there is a sample application with this gem configured?"
I'll add a +1 vote for that. The instructions in 'Getting Started' don't
work.

If anyone has a working application out of this gem, please could you post
it so we can see it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-42957089
.

@JohnSmall
Copy link

Ok, I've set stuff up as in the instructions. Made my first modification (because the instructions don't work) to get 'types' into the form helper
<%= multipart_uploader_form(input_name: 'uploader',$
uploader: 'VideoUploader',$
button_class: 'submit-button',~$
button_text: 'Upload selected videos',$
html: %Q{Select videos},$
types:%w(wmv avi mp4 mkv mov mpeg))$
%>$
And when I use the form I see three buttons, 'choose files', 'select videos' and 'upload selected videos'
'choose files' works, I can choose a file, but 'select videos' and 'Upload selected videos' do nothing. I'm puzzled why there should be 'choose files' and 'select videos' buttons, but we'll leave that.
The problem seems to be the modifications required to the javascript the instructions tell us to put in application.js. The code just sets the list of files to be an empty array. and the instructions further on down are vague and high level. So I know I need to change the javascript, but don't know what to change it to.

@JahangerGull
Copy link

yes things are confusing here.

Try these

https://github.com/JahangerGull/s3_multipart_example
http://s3-multipart-eg.herokuapp.com/file_upload/new

Only one thing is missing S3 keys and bucket name, bucket name is to be
given in 2 files one in aws.yml and other is application.js file.

Once done then file upload to S3 should work for you with multipart.

After this just select the file and clicking on "Upload selected videos"
will upload the selected file. (Select only one file).

Let me know if you are still facing any problem, though quite sure it will
work for you as its working for me :)

Thanks

On Tue, May 13, 2014 at 6:02 PM, John Small [email protected]:

Ok, I've set stuff up as in the instructions. Made my first modification
(because the instructions don't work) to get 'types' into the form helper
<%= multipart_uploader_form(input_name: 'uploader',$

uploader: 'VideoUploader',$

button_class: 'submit-button',~$

button_text: 'Upload selected videos',$

html: %Q{Select videos},$

types:%w(wmv avi mp4 mkv mov mpeg))$

%>$

And when I use the form I see three buttons, 'choose files', 'select
videos' and 'upload selected videos'
'choose files' works, I can choose a file, but 'select videos' and 'Upload
selected videos' do nothing. I'm puzzled why there should be 'choose files'
and 'select videos' buttons, but we'll leave that.
The problem seems to be the modifications required to the javascript the
instructions tell us to put in application.js. The code just sets the list
of files to be an empty array. and the instructions further on down are
vague and high level. So I know I need to change the javascript, but don't
know what to change it to.


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-42966639
.

@JohnSmall
Copy link

I tried your example code, change the bucket name to be the one I'm using, selected a file, pressed 'select videos' and 'upload' and nothing happens. If I check the console then I see that it hit console.log("There was an error") in application.js

If I try your heroku app then I get exactly the same thing (except the error has a different line number). But it works for you, what am I doing wrong? Pressing the buttons in the wrong order or something?

@JahangerGull
Copy link

What is the file size you are trying to upload ? there is min 5 MB file
size limit from S3 side.

Please confirm else will add proper setup on heroku so u can see file
uploading there.

Thanks

On Wed, May 14, 2014 at 4:30 PM, John Small [email protected]:

I tried your example code, change the bucket name to be the one I'm using,
selected a file, pressed 'select videos' and 'upload' and nothing happens.
If I check the console then I see that it hit console.log("There was an
error") in application.js

If I try your heroku app then I get exactly the same thing (except the
error has a different line number). But it works for you, what am I doing
wrong? Pressing the buttons in the wrong order or something?


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-43079884
.

@JohnSmall
Copy link

Working on your Heroku app

I tried with some larger files and I still get 'there was an error'

I select a file after pressing choose files, I press the 'select videos' button (I've no idea why that's there) and then press the upload button. Nothing happens and if I open up inspect element so I can see what's going out in the console I see 'there was an error'

I've also tried it without pressing 'select videos' and get the same thing.

What file types have you set the thing to accept?

Thanks

John

@JahangerGull
Copy link

Yes, i forgot to run migrations, please try to upload now on heroku server
it should work, just tested a 20MB mp4 file. In JS console you will be able
to see Network activities of file uploading.

Do test it today, as i will remove bucket configs in a day.

thanks

On Thu, May 15, 2014 at 12:32 PM, John Small [email protected]:

Working on your Heroku app

I tried with some larger files and I still get 'there was an error'

I select a file after pressing choose files, I press the 'select videos'
button (I've no idea why that's there) and then press the upload button.
Nothing happens and if I open up inspect element so I can see what's going
out in the console I see 'there was an error'

I've also tried it without pressing 'select videos' and get the same
thing.

What file types have you set the thing to accept?

Thanks

John


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-43188024
.

@JohnSmall
Copy link

Brilliant, it works now, and the copy of your example on my system. Seems that all I needed to do was select a file big enough, and with the appropriate extension.

What does that button 'select videos' do? It seems to be completely superfluous.

@JohnSmall
Copy link

Whoops, I forgot to add a big
THANKS

@JahangerGull
Copy link

Good to hear it works for you.

well i thinks it useless, you can ignore it and go ahead.

For now i am removing keys, heorku application will not allow you to upload
files any more.

Thanks

On Thu, May 15, 2014 at 3:32 PM, John Small [email protected]:

Whoops, I forgot to add a big
THANKS


Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-43203217
.

@keyeh
Copy link

keyeh commented Jan 30, 2016

@JahangerGull It works for me too. You are a lifesaver!

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

6 participants