Files
wace_plm/WebContent/SE2/sample/photo_uploader/file_uploader.php
chpark da06c4684c Initial commit: WACE PLM with database initialization features
- Add Docker Compose configurations for dev, prod, and standalone environments
- Add database initialization scripts (init-db.sh, init-db-docker.sh)
- Add enhanced start-docker-linux.sh with DB init support
- Add comprehensive database initialization guide
- Support for automatic dbexport.pgsql import on first run
- Include safety checks for production environment
2025-08-29 15:46:08 +09:00

37 lines
920 B
PHP

<?php
// default redirection
$url = $_REQUEST["callback"].'?callback_func='.$_REQUEST["callback_func"];
$bSuccessUpload = is_uploaded_file($_FILES['Filedata']['tmp_name']);
// SUCCESSFUL
if(bSuccessUpload) {
$tmp_name = $_FILES['Filedata']['tmp_name'];
$name = $_FILES['Filedata']['name'];
$filename_ext = strtolower(array_pop(explode('.',$name)));
$allow_file = array("jpg", "png", "bmp", "gif");
if(!in_array($filename_ext, $allow_file)) {
$url .= '&errstr='.$name;
} else {
$uploadDir = '../../upload/';
if(!is_dir($uploadDir)){
mkdir($uploadDir, 0777);
}
$newPath = $uploadDir.urlencode($_FILES['Filedata']['name']);
@move_uploaded_file($tmp_name, $newPath);
$url .= "&bNewLine=true";
$url .= "&sFileName=".urlencode(urlencode($name));
$url .= "&sFileURL=upload/".urlencode(urlencode($name));
}
}
// FAILED
else {
$url .= '&errstr=error';
}
header('Location: '. $url);
?>