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

Upload picture accept types #67

Open
PostMidnight opened this issue Jul 26, 2019 · 0 comments
Open

Upload picture accept types #67

PostMidnight opened this issue Jul 26, 2019 · 0 comments

Comments

@PostMidnight
Copy link

Hi @julianlam

Please consider adding accept to the file input:

  1. In formatting.js (composer) add picture: function() as follows:
var formattingDispatchTable = {
		picture: function () {
			var postContainer = this;
			postContainer.find('#pictures').click();
		},

		upload: function () {
			var postContainer = this;
			postContainer.find('#files').click();
		},
  1. In composer.tpl (that I copied from redactor ;) ) add input with id=pictures:
<form id="fileForm" method="post" enctype="multipart/form-data">
						<!--[if gte IE 9]><!-->
						<input type="file" id="files" name="files[]" multiple class="gte-ie9 hide"/>
						<input type="file" id="pictures" accept="image/*, video/*" name="files[]" multiple class="gte-ie9 hide"/>
						<!--<![endif]-->
						<!--[if lt IE 9]>
						<input type="file" id="files" name="files[]" class="lt-ie9 hide" value="Upload"/>
						<input type="file" id="pictures" accept="image/*, video/*" name="files[]" class="lt-ie9 hide" value="Upload"/>
						<![endif]-->
					</form>

A better way is to use the ACP defined mime types for files and pictures, but I have not been able to find such field in config.
Thanks!

@julianlam julianlam changed the title [Enhancement] Upload picture accept types Upload picture accept types Jul 31, 2019
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

1 participant