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

Cannot Use field with file type #725

Open
pradithahidayat opened this issue Oct 9, 2015 · 4 comments
Open

Cannot Use field with file type #725

pradithahidayat opened this issue Oct 9, 2015 · 4 comments
Labels

Comments

@pradithahidayat
Copy link

I tried to use field with file type to upload an image, but I didn't get any response from angular after I select a file from file selector.
Also I have to double click the Browse button to open the file selector, and it's rarely works with double click, sometimes it won't open the file selector.

Here is how I implement the file type:

    category.creationView()
        .fields([
            nga.field('version', 'string')
                .label('Version')
                .attributes({ placeholder: 'e.g. 1.0' }),
            nga.field('name', 'string').label('Category Name'),
            nga.field('iconNormal', 'file')
                .uploadInformation({
                    'url': 'http://localhost:1337/category/upload',
                    'apifilename': 'file'
                })
                .label('Icon Normal'),
        ]);

I already test my upload function with postman and it's worked.

@jeromemacias
Copy link
Contributor

Do you use last release of ng-admin, the 0.8 one ?
If yes, sorry, you must use the master version until the new 0.9 version is out.

@pradithahidayat
Copy link
Author

@jeromemacias yes correct, I used the 0.8 version.
Oke then, I'll wait for the new version.

Thanks for your response.

@DmitryPogodaev
Copy link

@jeromemacias hi!
I had the same problem and tried to use code from master.
Now files uploading to server and returning new filename, but: when i submiting form, req.body.imgs contains old names with new names separated by comma.
I tring to upload 6 files at 1 time and sometimes i getting 2 new names and 4 old. Sometimes i getting 5+1 or 0+6 new and old names of files.
This is how field configured:

nga.field('imgs', 'file').uploadInformation({ 'url': 'admin/upload/', 'multiple': true, 'apifilename': 'filename'}) 

@Kmaschta
Copy link
Contributor

Until we code a solution for the Image and Upload fields, here is a workaround: #541 (comment)

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

No branches or pull requests

4 participants