Git Product home page Git Product logo

dropzone-redux-form-example's People

Contributors

bbb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dropzone-redux-form-example's Issues

How to get the url for the files?

Hi, Sir, I have tried your code it always returned [object FileList] in the results. May I know how to get the url for it? because I use the react-dropzone to connect with cloudinary API and upload the images to the Cloudinary server. thank you if you know how to do it.

Empty FormData object

I have cloned the project and when i run in my browser, the console.info('POST', body, data); at line 40 (App.js) just shows a empty FormData. Is that normal?

Dotted Border

Thank you for the tutorial. It was helpful for a newbie like me. Is there anyway I can get rid of the dotted border in the dropzone? I tried looking for the style part of it but couldn't find it.

Wrong file attachment

When server get a request it sees that is a string

 files = "[object FileList]" 

$_FILES in php is empty

Errors while running the project

Hi @BBB and thanks for this project!
I tried to clone and run it, but at first i get 404 on these:
GET http://localhost:3000/build/vendor.css
GET http://localhost:3000/build/app.css
choosing/dragging a file does nothing, and hitting 'Submit' get me these:

Fetch API cannot load http://example.com/send/. No 'Access-Control-Allow-Origin' header is present on the requested resource.
App.js?a673:33 TypeError: Failed to fetch(โ€ฆ

Maybe i don't understand the purpose of the example, but i don't see any use of form validation/errors regarding dropzone.
I'll be happy to get some guidance about how to use your example.

How to upload the file along with json data using axios

I'm trying upload a zip file along with form data as you mentioned in your code.But , how to send it to server .Here is my code.

`var formData = new FormData();
 formData.append('modelfile', values.values.modelfile[0]);
 return axios.post('http://127.0.0.1:8000/addProduct',formData, { headers: {'Content-Type': 'multipart/form-data' }} ) 
.then(res=>dispatch({type:'PRODUCT_UPLOADED_SUCCESSFULLY'})) .catch(error=>dispatch({type:'PRODUCT_UPLOADED_FAILED'}))`

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method

Hi, Ollie,
I'm implementing a redux-form with Dropzone and other submission data. I tried your code and when I just tried to render the dropzone component, I got the subject error and in other instances, I'm getting "TypeError: Cannot read property 'value' of undefined at exports.default," which must be pointing to "const files = field.input.value;".

I don't think I'm exporting and importing wrong. Do you know what is wrong with it?

import React, { Component, PropTypes, } from 'react';
import Dropzone from 'react-dropzone';
import { reduxForm, Field } from 'redux-form';


const FILE_FIELD_NAME = 'files';

const renderDropzoneInput = (field) => {
  const files = field.input.value;
  return (
    <div>
      <Dropzone
        name={field.name}
        onDrop={(filesToUpload, e) => field.input.onChange(filesToUpload)}
      >
        <div>Try dropping some files here, or click to select files to upload.</div>
      </Dropzone>
      {field.meta.touched &&
        field.meta.error &&
        <span className="error">{field.meta.error}</span>}
      {files && Array.isArray(files) && (
        <ul>
          { files.map((file, i) => <li key={i}>{file.name}</li>) }
        </ul>
      )}
    </div>
  );
};

export default renderDropzoneInput;

When importing:
import renderDropzoneInput from './images/render_dropzone_input';

My render method:

render() {
    return (
      <div>
        {this.renderFields()}
      <div>
      <label htmlFor={FILE_FIELD_NAME}>Files</label>
       <Field
         name={FILE_FIELD_NAME}
         component={renderDropzoneInput}
       />
      </div>
      </div>
    );
  }
}

No Preview Displayed

Integrating with Rails, I've copied this example as-is, and I'm getting the data, but there's no feedback (progress) or preview displayed. Could you shed any light on why that might be the case?

If I modify the example to add <img src={file.preview} /> when the uploaded file is listed, it shows up, but that's not the expected default behavior, is it?

Not including code only because it's exactly what you have here... except in a Rails context (i.e., the component is served up as a view). I suspect I'm just having a mental disconnect between Dropzone and dropzone.js in terms of configurability.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.