runtime: php55 api_version: 1 handlers: - url: /index.php script: index.php - url: /static static_dir: static
google_app_engine.disable_readonly_filesystem = 1
<?php if(isset($_FILES['UploadFileField'])){ // if($_POST['passwordField']['value'] == "a"){ // }else{ // die("Wrong Password"); // } // Creates the Variables needed to upload the file $UploadName = $_FILES['UploadFileField']['name'];// $UploadName = mt_rand(100000, 999999).$UploadName; $UploadTmp = $_FILES['UploadFileField']['tmp_name']; $UploadType = $_FILES['UploadFileField']['type']; $FileSize = $_FILES['UploadFileField']['size']; // Removes Unwanted Spaces and characters from the files names of the files being uploaded// $UploadName = preg_replace("#[^a-z0-9.]#i", "", $UploadName); // Upload File Size Limit // if(($FileSize > 125000)){ // die("Error - File too Big"); // } // Checks a File has been Selected and Uploads them into a Directory on your Server if(!$UploadTmp){ die("No File Selected, Please Upload Again"); }else{ move_uploaded_file($UploadTmp, "static/$UploadName"); } }?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><style>body { margin:0; padding:0; background-color:#CCC; }.fileuploadholder { width:400px; height:200px; margin: 60px auto 0px auto; background-color:#FFF; border:1px solid #CCC; padding:6px;}</style><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>File Upload</title></head><body><div class="fileuploadholder"> <form action="/index.php" method="post" enctype="multipart/form-data" name="FileUploadForm" id="FileUploadForm"> <!--<input type="password" name="passwordField" id="passwordField"></input>--> <label for="UploadFileField"></label> <input type="file" name="UploadFileField" id="UploadFileField" /> <input type="submit" name="UploadButton" id="UploadButton" value="Upload" /> </form></div></body></html>And one empty directory.
URL and file path patterns use POSIX extended regular expression syntax
<?php
if (isset($_FILES['UploadFileField'])) {
// if($_POST['passwordField']['value'] == "a") {
// }else{
// die("Wrong Password");
// }
// Creates the Variables needed to upload the file
// }else{
// die("Wrong Password");
// }
// Creates the Variables needed to upload the file
$UploadName = $_FILES['UploadFileField']['name'];
// $UploadName = mt_rand(100000, 999999).$UploadName;
$UploadTmp = $_FILES['UploadFileField']['tmp_name'];
$UploadType = $_FILES['UploadFileField']['type'];
$FileSize = $_FILES['UploadFileField']['size'];
// Removes Unwanted Spaces and characters from the files names of the files being uploaded
// $UploadName = preg_replace("#[^a-z0-9.]#i", "", $UploadName);
// Upload File Size Limit
// if(($FileSize > 125000)){
// die("Error - File too Big");
// }
// Checks a File has been Selected and Uploads them into a Directory on your Server
// $UploadName = preg_replace("#[^a-z0-9.]#i", "", $UploadName);
// Upload File Size Limit
// if(($FileSize > 125000)){
// die("Error - File too Big");
// }
// Checks a File has been Selected and Uploads them into a Directory on your Server
if (!$UploadTmp) {
die(
die("No File Selected, Please Upload Again");
} else {
} else {
move_uploaded_file($UploadTmp, "static/$UploadName");
}
}
?>
google_app_engine.disable_readonly_filesystem
- By default PHP applications are not allowed to write to the filesystem. Setting this directive to "1" will lift the restriction for the local development environment. However, the setting does not apply to applications running in production, which are always subjected to the sandbox restrictions.* Compute Engine Documentation: Running a basic Apache web server* Compute Engine Documentation: Setting Up LAMP on Compute Engine
* App Engine PHP Documentation: Allowing Users to Upload Files
* App Engine PHP Documentation: Reading and Writing Files
* App Engine PHP Documentation: Advanced File Management