Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

File uploads are not saving #11

Closed
Flibio opened this issue Mar 18, 2017 · 8 comments
Closed

File uploads are not saving #11

Flibio opened this issue Mar 18, 2017 · 8 comments

Comments

@Flibio
Copy link

Flibio commented Mar 18, 2017

I've added a file upload field to FlexDirectory, but the file I upload is not being saved. There is no error, and FlexDirectory says "Successfully saved". I am using the latest FlexDirectory version.

Here is my new entires.yaml:

title: Flex Directory
form:
  validation: loose

  fields:
    published:
      type: toggle
      label: Published
      highlight: 1
      default: 1
      options:
        1: PLUGIN_ADMIN.YES
        0: PLUGIN_ADMIN.NO
      validate:
        type: bool
        required: true
    last_name:
      type: text
      label: Last Name
      validate:
        required: true
    first_name:
      type: text
      label: First Name
    email:
      type: email
      label: Email
      validate:
        required: true
    website:
      type: text
      label: Website
    item_image:
      type: file
      label: Item Image
      random_name: true
      destination: 'user/data/flex-directory/files'
      multiple: true
    tags:
      type: selectize
      size: large
      label: Tags
      classes: fancy
      validate:
        type: commalist

    # Don't mess with this stuff below unless you know what you are doing
    tools_section:
      type: section
      field_classes: overlay bottom

      fields:
        _post_entries_save:
          label: PLUGIN_FLEX_DIRECTORY.AFTER_SAVE
          type: save-redirect
          default: create-new
@dm9876
Copy link

dm9876 commented Mar 19, 2017

as a point of contrast. I have it working successfully. here is the field definition that I am using in my entries.yaml

photo:
      type: file
      label: Photo
      multiple: false
      destination: 'user/pages/images'
      accept:
        - image/*

@rhukster
Copy link
Member

rhukster commented Mar 19, 2017

@Flibio what kinds of files are you trying to upload? The default is for images only unless you specify an accept: option.

@Flibio
Copy link
Author

Flibio commented Mar 19, 2017

@rhukster: I attempted to upload a JPG file.

@rhukster
Copy link
Member

can you try removing random_name to see if It makes any diff?

@Flibio
Copy link
Author

Flibio commented Mar 19, 2017

That seems to have fixed it, thanks.

@Flibio Flibio closed this as completed Mar 19, 2017
@rhukster
Copy link
Member

It's weird though because I have tested that random filename stuff on my local and it worked fine. file is totally saved, of course the filename is random, so you have to iterate over the files and grab the name to use it.

@rhukster
Copy link
Member

I just tested with random name and it works fine: my example config:

    custom_file:
      type: file
      label: Custom File
      random_name: true
      destination: 'user/data/flex-directory/assets'
      multiple: true

2017-03-20 at 4 51 pm

This is how it looks after save. Notice I have random filenames showing there after save.

@Flibio
Copy link
Author

Flibio commented Mar 21, 2017

It actually seems to be working now, albeit with a different file. Perhaps the file was too large (3MB), would this plugin display an error if that was the case?

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

No branches or pull requests

3 participants