Hot answers tagged

7 votes

Upload file size limits to 256MB

When determining the maximum upload file size, Craft first takes the php.ini file upload_max_filesize, post_max_size and memory_limit into account by getting the minimum value and only then applying ...
Brad Bell's user avatar
  • 67.3k
6 votes

How to rename filename of asset before (or after) upload in Craft 3

Well, after searching for this for more than 2 hours, I bumped into a working solution; Event::on( Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function(ElementEvent $event) { ...
Arjan's user avatar
  • 141
5 votes
Accepted

Images containing EXIF orientation tag are not rotated on upload

After some mail exchanges with Brad and Andris from Craft CMS, it turned out that there is an edge case where the image rotation on upload will not work if the EXIF extension is not installed (which ...
kant312's user avatar
  • 496
5 votes

Upload any size image into carousel

You shouldn't need to create a custom plugin to do that. You can easily create a Matrix content field for your carousel. Create a new block called slide. From there you can create an asset field to ...
Rob Erskine's user avatar
5 votes
Accepted

Error uploading .bmp file format - gets rejected

You're probably using GD, which doesn't support BMP files. If you install Imagick on your server, Craft will use it automatically and it supports a much wider range of file types, including BMP ...
Brad Bell's user avatar
  • 67.3k
4 votes
Accepted

How to control the format of an asset's Title

For Craft 2, You can write a plugin that listens to the onBeforeSaveAsset event, and changes the title from the asset parameter to whatever you want. Something like: if ($event->params['isNewAsset]...
Brad Bell's user avatar
  • 67.3k
4 votes

Adding images directly to public folder

You need to use the Update Asset Indexes tool in Settings in the control panel: Whenever there are files within your asset source that were not added directly by Craft (e.g. via FTP), you will need ...
Marion Newlevant's user avatar
4 votes
Accepted

Error on upload: "Impossible to create the root directory..."

I understand now within the context of you are using docker. Since docker creates a new file system separate from your computer's file system, you will want to run these commands on the docker ...
Clark Nelson's user avatar
3 votes
Accepted

How does Craft handle uploading assets to AWS?

They are uploaded to Craft first to a temporary file, then Assets uses the Asset Source to work out where to send them next - either the local file system or a remote one. For handling large uploads ...
Josh Angell's user avatar
  • 2,311
3 votes

Upload Image Custom Field

I believe you are looking for the Assets Field
Ben Parizek's user avatar
  • 13.4k
3 votes
Accepted

Dynamic Subfolders leaving empty folders behind

When Assets moves files around because of dynamic Assets folder changes, it does not remove empty folders. On the surface it seems like a no-brainer - just check if the folder is empty and if so, ...
Andris Sevcenko's user avatar
3 votes

Upload and crop profile photo in frontend

This is a very old question, but thanks to this example I was able to build quickly a profile picture form using Craft 3 and jQuery File Upload plugin (thank you!). The action value and file input ...
Romain P.'s user avatar
  • 1,798
3 votes

How can I get a restricted Asset Allowed File Type upload to accept RTF files

Does this help you? It'll let you add additional file extensions that are allowed to be uploaded. http://buildwithcraft.com/docs/config-settings#allowedFileExtensions
Rick's user avatar
  • 566
3 votes

Image upload failed- file not writable

On the server, check: if the folder exists? Check the folder permissions are set to 777 (could probably reduce to 755) Within Craft: In: Settings > Assets > Asset Sources - make sure File System ...
Matt P's user avatar
  • 1,538
3 votes
Accepted

Front end assets uploading, does not appear to be a an image error

The issue lies if you have a Preparse field in that field layout, see details here: https://github.com/aelvan/Preparse-Field-Craft/issues/23
Tim Kelty's user avatar
  • 3,071
3 votes

Upload file size limits to 256MB

Apparently, Craft requires memory_limit to also be set to max value, so setting memory_limit in php.ini did solve my problem.
Lukigi's user avatar
  • 565
3 votes
Accepted

How can I insert images into a Redactor rich text field in a front-end form?

It doesn't seems possible natively, you should write a custom upload script. → Example #1 → Example #2 If it doesn't matter to add the images inside your rich text field, one more simple workaround ...
Romain P.'s user avatar
  • 1,798
3 votes
Accepted

Default Upload Location needs matrix field and entry info... How?

If your desired URL is: http://sitename.com/uploads/towns/town-slug/album-name/filename.jpg The the "Upload Location" for the setup you described would be something like: towns/{owner.slug}/{...
Brad Bell's user avatar
  • 67.3k
3 votes

Uploaded images are saving to the server's temp folder and throwing 500 errors

Crappy shared web hosting? That would be my guess. It seems imprudent to be developing a site on the same host as a live site, it has to share the (probably already stretched) resources available on ...
Seth Warburton's user avatar
3 votes
Accepted

Uploaded Assets always get 600 File Permission and are therefore not displayed (403 Error)

I just missed the "Assets in this volume have public URLs" lightswitch while setting up the volume :)
Rattikarl's user avatar
  • 393
3 votes

Laravel Forge not honoring Craft 3 maxUploadFileSize config setting

After doing some digging, this article helped solve my issue: https://stackoverflow.com/questions/36582004/increase-upload-max-filesize-via-forge. By increasing the post_max_size in the PHP FPM ...
Jonathan Simcoe's user avatar
3 votes

Laravel Forge not honoring Craft 3 maxUploadFileSize config setting

Check out nginx-craft specifically: https://github.com/nystudio107/nginx-craft/blob/master/forge-example/NginxConfiguration.conf#L25 # Disable limits on the maximum allowed size of the client ...
andrew.welch's user avatar
  • 11.4k
2 votes

Uploaded images stripped of EXIF data

For Craft 3 the setting 'preserveExifData' in config/general.php should be set to true
Niek's user avatar
  • 49
2 votes

File upload - maximum upload size of 0 B

I had the same problem, changing post_max_size in php.ini to something other than 0 (I used 8M) did it for me. I'm not sure why this works: php.ini says a value of 0 should disable the limit ...
Paul's user avatar
  • 339
2 votes
Accepted

Craft Commerce: Upload File Field in Order?

This is definitely possible. First create a file field to attach to your order in the control panel. Then create a file input type with a name attribute that uses the field you created name="fields[...
Luke Pearce's user avatar
  • 3,863
2 votes

Upload failed for filename. The path doesn't exist

I suspect your public root is something else/more than just /public_html. Try adding the following to your index.php file, and refresh your site: die($_SERVER['DOCUMENT_ROOT']); Your real public ...
Mats Mikkel Rummelhoff's user avatar
2 votes
Accepted

JPG upload not completing in Craft 2.6.2789

My guess is you had an auto-update or a git deployment go bad and some files didn't get updated properly. To be safe, I'd download a fresh copy of Craft from https://craftcms.com and replace your ...
Brad Bell's user avatar
  • 67.3k
2 votes

Uploaded image not appearing

My first step to troubleshooting this is to confirm that the Asset Source URL is correct in the source settings.
CraftQuest's user avatar
2 votes
Accepted

Upload images bigger than 1MB not working

Nginx's setting client_max_body_size was set to its default value of 1M because it was not specified after provisioning the DO server with Laravel Forge. Weird thing is just that the user doesn't get ...
Johannes's user avatar
  • 740
2 votes

Asset Uploading via Assets Field Broken, please help

This is normally caused due to a 500 error and monitoring the AJAX request using your browser's dev toolbar or using the log file craft/storage/runtime/logs should give you a clearer picture. It's ...
Regan Lawton's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible