Closed FrodeMMeling closed 10 years ago
What version of Transit are you using? What's the name of the file being uploaded?
installed from composer:
mjohnson/admin 1.3.2 A CakePHP admin plugin.
mjohnson/decoda 6.4.3 A lightweight lexical string parser for BBCode styled markup.
mjohnson/transit 1.5.0 A file uploader with support for validation, image transformation and remote transportation.
mjohnson/uploader 4.5.2 File uploader and validation plugin for CakePHP.
mjohnson/utility 1.6.6 A collection of CakePHP utility libraries.
I added a formatName and dumped the $name and $file array:
/Model/FileUpload.php (line 24)
'IMG_3167'
/Model/FileUpload.php (line 25)
object(Transit\File) {
[protected] _cache => array()
[protected] _data => array(
'name' => 'IMG_3167.jpg',
'type' => 'image/jpeg',
'tmp_name' => '/Users/username/dev/apps/myapp/tmp/IMG_3167.jpg',
'error' => (int) 0,
'size' => (int) 1882907
)
[protected] _path => '/Users/username/dev/apps/myapp/filestore/assetFiles/IMG_3167.jpg'
}
file is stored into assetFiles folder, but as .jpg
What PHP version are you using? I wonder if you have an outdated PCRE: http://www.php.net/manual/en/pcre.installation.php
Or you don't have unicode enabled. http://www.php.net/manual/en/regexp.reference.unicode.php
Would need to install php with --enable-unicode-properties
. I wonder if I can check for this.
I have PHP 5.5.10. I do not think PCRE can be turned off in this version. (from:php.net As of PHP 5.3.0 this extension cannot be disabled and is therefore always present.) cake version 2.4.6.
from php -i :
echo PCRE_VERSION; = 8.34 2013-12-1
Must be not compiled with unicode properties. Let me see if thats easy to figure out.
I have a regular setup om OSX using homebrew and josegonzalez/homebrew-php
Can you run this in terminal pcretest -C
? I'm curious if it's related to the PHP PCRE.
PCRE version 8.34 2013-12-15
Compiled with
8-bit support
UTF-8 support
16-bit support
UTF-16 support
32-bit support
UTF-32 support
Unicode properties support
Just-in-time compiler support: x86 64bit (little endian + unaligned)
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Parentheses nest limit = 250
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
Probably not a unicode issue then. I'm curious, can you test something for me?
On the regex line: https://github.com/milesj/transit/blob/master/src/Transit/File.php#L413
Try escaping the -
and see if that fixes it.
Yep. Now it works:
$name = preg_replace('/[^_\-\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]/imu', '-', $name);
Weird. I wonder why no one else has ran into the problem before (might be a 5.5 issue). Easy fix though.
When uploading I get this error:
Is this a known problem? File is uploaded and moved to correct folder, but filename is empty causing image column to only get.jpg as name.