[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Проблема с загрузкой изображений, прошу помощи
Helloween
Привет всем! Возникла проблема. Имеется флэш ролик swf в который клиент загружает свою фотку. Для загрузки изображения используется php обработчик, который отправляет картинку сначала на сервер, а с сервера загружает в флэш ролик, , после чего клиент кадрирует и отправляет полученный результат на сервер. Все было хорошо, пока мы не перешли с поддержки php 5.3 на php 5.6. После перехода на php 5.6 картинка загружается на сервер но не подгружается во флэш ролик, просто идет безконечная загрузка и все.
Я склоняюсь к тому, что, когда то давно написанный php код работает не корректно на php 5.6

Прошу вас посмотреть код, может что то посоветуете как его оптимизировать, я в php не разбираюсь
Спасибо!
<?php

if(isset($_FILES['Filedata'])) { // basically if file data exists to actually upload.

$maximum_filesize = 1500 * 2000; // 9000KB
$destination_dir = 'images/'; // where we end up putting the file. Be sure this folder exists on your server


function getExtension($file_name) { // this function gets called on line 24
// The strrpos() function finds the numerical position of the last occurrence of a string inside another string (in this case, the period).

$i = strrpos($file_name,".");
if ( !$i ) {
return "";
}
$h = strlen($file_name) - $i; // The strlen() function returns the length of a string.

$ext = substr($file_name, $i+1, $h); // The substr() function returns a part of a string.
//The three parameters in paranthesis are (the string, start location, length to slice out).


return $ext; // this function returns our extension (like jpg or png, etc)
} // closes out the getExtension function


$filename = stripslashes($_FILES['Filedata']['name']); // The stripslashes() function removes backslashes added by the addslashes() function.
$extension = getExtension($filename); //uses the function we created above
$extension = strtolower($extension); // The strtolower() function converts a string to lowercase. So JPG would become jpg

// if statement below will test to make sure the extension is equal to one of these 4 values.

if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) {

//if the extension was not equal to at least one of those extensions above then upload is aborted.
exit( "unable to upload file ($filename)" ); // we exit out of the script entirely with an error message

} // closes off if statement

// finally we test to make sure the filesize is below the max file size we set above.

if ($_FILES['Filedata']['size'] <= $maximum_filesize){

if($fileNameAddOn != "" ) { // if fileNameAddOn does not equal nothing
move_uploaded_file($_FILES['Filedata']['tmp_name'], $destination_dir.$fileNameAddOn.$_FILES['Filedata']['name']); // upload with the filename add on variable

} else {
move_uploaded_file($_FILES['Filedata']['tmp_name'], $destination_dir.$_FILES['Filedata']['name']); // upload without the filename add on variable
}


}
// closes off if statement that checks the filesize


}


?>
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.