-
Notifications
You must be signed in to change notification settings - Fork 58
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
Strange error when uploading image #87
Comments
I fixed this problem by removing the usage of the File class... somehow my CakePHP installation cannot access the temporary file this way. function _copyFileFromTemp($tmpName, $saveAs, $filePermission) {
$results = true;
if (!is_uploaded_file($tmpName)) {
return false;
}
if(move_uploaded_file($tmpName, $saveAs)) {
chmod($saveAs, $filePermission);
} else {
// if normal upload fails, try the cake way
$file = new File($tmpName, $saveAs);
$temp = new File($saveAs, true, $filePermission);
debug($file);
debug($temp);
if (!$temp->write($file->read())) {
die('test');
$results = __d('meio_upload', 'Problems in the copy of the file.', true);
}
$file->close();
$temp->close();
}
return $results;
} |
Thanks a lot! This fixed it for me too. |
Nice it helped :) Verstuurd vanaf mijn iPhone Op 3 mrt. 2012 om 00:33 heeft "Nikola Paradzik" [email protected] het volgende geschreven:
|
Works for me tks! |
Hi,
I've just discovered this branche for the MeioUpload behavior. I had just set up the 1.0.1 version, which worked fine. When I discovered it wasn't actually using PHPThumb, I decided to switch to this version. When replacing the code with this one I get the following errors:
Warning (2): file_get_contents() [function.file-get-contents]: Unable to access /phpsKmFIm [CORE/cake/libs/file.php, line 170]
Warning (2): file_get_contents(/phpsKmFIm) [function.file-get-contents]: failed to open stream: Inappropriate ioctl for device [CORE/cake/libs/file.php, line 170]
Also some PHPThumb errors which are probably caused by the PHP errors:
phpThumb() v1.7.10-201104242100
Unknown image type identified by "" () in SourceImageToGD() [3523]
Edit: I have analysed the code and it seems the behavior is using the CakePHP File class to handle the actual upload. Isn't it more easier to just use PHP's move_uploaded_file()? Is there some reason for using the File class?
The text was updated successfully, but these errors were encountered: