Sitecore 9 login: An Error Occurred, String or binary data would be truncated

This is caused by Sitecore generating a login ticket too long to be stored in the database, hence the data would be truncated. I'm not sure why this happens, but it looks like the URL (or part of the URL) is included in the ticket, causing it to be longer than the datatype in the database allows.

Here's the stacktrace from the log:

Nested Exception
Exception: System.Data.DataException
Message: Error executing SQL command: INSERT INTO [Properties] ( [Key], [Value] ) VALUES ( @name, @value )
Nested Exception
Exception: System.Data.SqlClient.SqlException
Message: String or binary data would be truncated.
The statement has been terminated.
Source: .Net SqlClient Data Provider



The solution is to delete the ticket directly in the core database, consequently forcing Sitecore to generate a new ticket upon next login. Run the following SQL query and make sure to target the impacted user by replacing "Username" with something uniquely identifying the user.

DELETE FROM [Project_Core].[dbo].[Properties]
WHERE [Project_Core].dbo.Properties.[Key] LIKE 'CORE_SC_TICKET%'
AND [Project_Core].dbo.Properties.[Value] LIKE '%Username%'


Select multiple files in Sitecore file upload dialog

In order to be able to select multiple files in Sitecore's media file uploader, you need to modify the UploadMedia.xml file (located in sitecore\shell\Applications\Media\Upload Media). Specifically, you need to add the multiple="multiple" attribute to the input tag as shown below:

<input id="File" name="File" type="file" style="width:100%" multiple="multiple" />

Here's the full file:

<?xml version="1.0" encoding="utf-8" ?>
<control xmlns:def="Definition" xmlns="">
    <FormDialog Icon="Business/32x32/Paperclip.png" FormTarget="sitecoreattach" Enctype="multipart/form-data" Header="Upload File"
                Text="Select a file. When done click the Upload button." OKButton="Upload">

      <Script Key="Upload">

        function submit() {
        try {
        catch(e) {

      <CodeBeside Type="Sitecore.Shell.Applications.Media.UploadMedia.UploadMediaForm,Sitecore.Client"/>

      <input id="ItemUri" name="ItemUri" type="hidden" value=""/>

      <Border Padding="0px 0px 4px 0px">
        <Literal Text="File name:" />

      <input id="File" name="File" type="file" style="width:100%" multiple="multiple" />