示例#1
0
function cacheTorrent($torrent)
{
    $torrent = base64_decode($torrent);
    $fp = tempnam('/tmp', 'soapApi');
    file_put_contents($fp, $torrent);
    $toReturn = handle_upload($fp);
    unlink($fp);
    return $toReturn;
}
示例#2
0
function select_action()
{
    if ( !empty($_FILES) ) { // POST
        return handle_upload();
    }
    if ( $_GET["action"] == "view" ) {
        return handle_view();
    }
    else {
        return handle_index();
    }
}
 function screen_change_bg()
 {
     global $bp;
     //if the form was submitted, update here
     if (!empty($_POST['bpprofbg_save_submit'])) {
         if (!wp_verify_nonce($_POST['_wpnonce'], 'bp_upload_profile_bg')) {
             die(__('Security check failed', 'bppbg'));
         }
         if (handle_upload()) {
             bp_core_add_message(__('Profile banner successfully uploaded.', 'bppg'));
         }
     }
     //hook the content
     add_action('bp_template_title', 'page_title');
     add_action('bp_template_content', 'page_content');
     bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
 }
session_start();
require __DIR__ . '/vendor/autoload.php';
use League\Csv\Reader;
use SimpleCrud\SimpleCrud;
$pdo = new PDO('mysql:host=www.db4free.net;port=3306;dbname=fultonfile', 'fultonfile', 'qweasd123qweasd123');
define("RESULT_FILE", "https://fultonfile-agusnurwanto.rhcloud.com");
// echo "<pre>". print_r($_FILES,1) ."</pre>";
// die();
$res = array("error" => 0);
if (!empty($_POST['action']) && $_POST['action'] == "read_csv" || !empty($_FILES) && $_FILES['async-upload']["type"] == "text/csv") {
    $pathResultReadCSV = __DIR__ . "/uploads/resultReadCSV.json";
    $file = array();
    $cekFile = true;
    if (!file_exists($pathResultReadCSV)) {
        $file = handle_upload();
        $cekFile = false;
    }
    if (empty($file["error"])) {
        if (empty($cekFile)) {
            $csv = Reader::createFromPath($file["file"]);
            $csvData = $csv->setOffset(1)->fetchAll();
            $keys = [];
            foreach ($csvData as $k => $v) {
                if (!empty($v[1])) {
                    $key = getKey($v[1]);
                    $keys[] = $key;
                } else {
                    if (!empty($v[0])) {
                        $key = getKey($v[0]);
                        $keys[] = $key;
示例#5
0
}
import("models.user");
global $User;
$user = $User->get_current();
if (!$user || !$user->has_permission("api.filesystem.upload")) {
    upload_output(array(status => "failed", details => "Contact administrator; Your account lacks uploading permissions."));
    die;
}
if (isset($_FILES['Filedata']) || isset($_FILES['uploadedfile'])) {
    $file = isset($_FILES['Filedata']) ? $_FILES['Filedata'] : $_FILES['uploadedfile'];
    if (handle_upload($file)) {
        upload_output(array(status => "success", details => $_FILES['uploadedfile']['name']));
    } else {
        upload_output(array(status => "failed", details => "Contact administrator; could not write to disk"));
    }
} elseif (isset($_FILES['uploadedfile0'])) {
    $cnt = 0;
    $ar = array();
    $res = true;
    while (isset($_FILES['uploadedfile' . $cnt]) && $res) {
        $res = handle_upload($_FILES['uploadedfile' . $cnt]);
        $cnt++;
    }
    if ($res) {
        upload_output(array(status => "success", details => "Uploaded " . $cnt . " files"));
    } else {
        upload_output(array(status => "failed", details => "Contact administrator; could not write to disk"));
    }
} else {
    upload_output(array(status => "failed", details => "No file uploaded"));
}
示例#6
0
<?php

include_once dirname(__FILE__) . '/inc/main.inc.php';
// to allow for big files
set_time_limit(0);
ini_set('upload_max_filesize', 6 * 1048576);
print_head();
echo "<h2>Upload:</h2>\n";
upload_error_handler(handle_upload($_FILES['torrent']['tmp_name']));
function upload_error_handler($error)
{
    global $SETTINGS;
    // only do error check test if the value we get back is purely a number
    if (is_numeric($error) && strlen($error) == 2) {
        switch ($error) {
            case TORRAGE_FILE_NOT_FOUND:
                echo <<<HTML
\t\tError: File empty
\t\t<p>If you want to upload another file, go <a href="/">back</a> to the main page.</p>

HTML;
                break;
            case TORRAGE_FILE_EMPTY:
                echo <<<HTML
\t\tError: File empty
\t\t<p>If you want to upload another file, go <a href="/">back</a> to the main page.</p>

HTML;
                break;
            case TORRAGE_FILE_INVALID:
                echo <<<HTML
示例#7
0
        unlink(realpath('./') . '/images/' . $row['imagename'] . '_sm1.' . $row['ext']);
        unlink(realpath('./') . '/images/' . $row['imagename'] . '_sm4.' . $row['ext']);
        $sql = 'delete from tb_client_images where id=' . $_GET['idel'];
        $res = mysql_query($sql);
        if ($res) {
            $msg = 'Image #' . $_GET['idel'] . ' removed successfully';
        } else {
            $err = 'Failed to remove image #' . $_GET['idel'] . '-' . mysql_error();
        }
    }
}
$err = '';
if ($_POST['submitedit'] != '') {
    $bname = basename($_FILES['brokerage_image']['name']);
    $pname = basename($_FILES['personal_image']['name']);
    handle_upload($id);
    if ($id != '') {
        $sql = 'update tb_users set gender="' . $_POST['gender'] . '", firstname="' . htmlentities($_POST['firstname'], ENT_QUOTES) . '",lastname="' . htmlentities($_POST['lastname'], ENT_QUOTES);
        $sql .= '",phone="' . htmlentities($_POST['phone'], ENT_QUOTES) . '",email="' . htmlentities($_POST['email'], ENT_QUOTES) . '",password=aes_encrypt("' . $_POST['password'] . '","tonyb")';
        $sql .= ', twitter_account="' . htmlentities($_POST['twitter_account'], ENT_QUOTES) . '",website="' . htmlentities($_POST['website'], ENT_QUOTES) . '",brokerage_name="' . htmlentities($_POST['brokerage_name'], ENT_QUOTES) . '"';
        if ($bname != '') {
            $sql .= ',brokerage_image="' . $bname . '"';
        }
        if ($pname != '') {
            $sql .= ',personal_image="' . $pname . '"';
        }
        $sql .= ' where id=' . $id;
        $res = mysql_query($sql);
        if ($res) {
            $msg = 'Updated Successfully';
        } else {
示例#8
0
    require_once "user.php";
    $user = geni_loadUser();
}
if ($in_maintenance_mode && !is_null($user) && !$user->isAllowed(CS_ACTION::ADMINISTER_MEMBERS, CS_CONTEXT_TYPE::MEMBER, null) or $in_lockdown_mode) {
    //  error_log("KMCert disabling input");
    $enable = False;
    $disabled = " disabled ";
    //} else {
    //  error_log("KMCert NOT disabling input");
}
if (key_exists($generate_key, $_REQUEST) and $enable) {
    // User has asked to generate a cert/key.
    generate_cert($ma_url, $km_signer, $member_id);
}
if (key_exists($upload_key, $_REQUEST) and $enable) {
    $status = handle_upload($ma_url, $km_signer, $member_id, $error);
}
if (key_exists($download_key, $_REQUEST)) {
    download_cert($ma_url, $km_signer, $member);
    return;
}
// If invoked with a ?redirect=url argument, grab that
// argument and go there from the 'continue' button
$redirect_key = "redirect";
//$redirect_address = "home.php";
$redirect_address = "";
if (array_key_exists($redirect_key, $_GET)) {
    $redirect_address = $_GET[$redirect_key];
}
// Set up the error display
if (isset($error)) {
$replace_image_str = _('Replace Image');
output_header("{$replace_image_str}: {$project->nameofwork}");
echo "<h1>{$project->nameofwork}</h1>\n";
echo "<h2>{$replace_image_str}: {$image}</h2>\n";
if (!$project->can_be_managed_by_current_user) {
    echo "<p>", _('You are not authorized to manage this project.'), "</p>\n";
}
if (!is_file("{$projects_dir}/{$projectid}/{$image}")) {
    // This too should only happen if someone is URL-tweaking.
    // (Or conceivably, the file was recently deleted, and the user
    // has an image_index that was generated before the deletion.)
    echo "<p>", _('There is no such image in the project.'), "</p>\n";
}
if (isset($_FILES['replacement_image'])) {
    // The user has uploaded a file.
    $err_msg = handle_upload($_FILES['replacement_image']);
    if ($err_msg == '') {
        echo "<p>", _('Image successfully replaced.'), "</p>\n";
        echo "<p>", "<a href='{$code_url}/tools/proofers/images_index.php?project={$projectid}'>", _('Return to Images Index'), "</a>", "</p>\n";
        exit;
    } else {
        echo "<p>";
        echo _('An error occurred.'), "\n";
        echo $err_msg, "\n";
        echo _('Please try again.'), "\n";
        echo "</p>\n";
        // Fall through to try again.
    }
}
echo "<p>", _('Select a replacement image to upload:'), "</p>\n";
echo "\n    <form enctype='multipart/form-data' action='replace_image.php' method='post'>\n    <input type='hidden' name='projectid' value='{$projectid}'>\n    <input type='hidden' name='image' value='{$image}'>\n    <input type='file' name='replacement_image' size='50'>\n    <br>\n    <input type='submit' value='", attr_safe(_("Upload Image")), "'>\n    </form>\n";
示例#10
0
<?php

header('Location:search_post.php');
require_once 'db.php';
// this is a person.
if (count($_POST) != 0) {
    if (isset($_POST['action']) && $_POST['action'] == 'comment') {
        add_comment($_GET['id'], $_POST);
    } elseif (isset($_POST['action']) && $_POST['action'] == 'photo') {
        handle_upload($_GET['id']);
    } else {
        update_record($_GET['id'], $_POST);
    }
}
if (!isset($_GET['id'])) {
    header('Location: /');
    exit;
}
$person = load_record($_GET['id']);
if (empty($person)) {
    header('Location: /');
    exit;
}
$updates = get_updates($_GET['id']);
$comments = get_comments($_GET['id']);
$photos = get_photos($_GET['id']);
$searcher = get_searcher($_GET['id']);
$title = $person['fullname'];
//$title = msg('People');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
示例#11
0
    if (isset($_POST["PHPSESSID"])) {
        session_id($_POST["PHPSESSID"]);
    }
}
session_start();
error_reporting(0);
if (isset($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_GET['sid'])) {
    $sid = $_GET['sid'];
}
if (isset($_GET['cid'])) {
    $cid = $_GET['cid'];
}
$err = handle_upload($id, $sid, $cid);
function handle_upload($id, $sid, $cid)
{
    global $path, $config, $newname, $filename;
    $pth = realpath('.') . '\\images';
    if (!is_dir($pth)) {
        mkdir($pth);
    }
    $err = '';
    foreach ($_FILES as $file) {
        switch ($file['error']) {
            case 0:
                if ($file['name'] != NULL) {
                    $err = processFile($file['name'], $file['tmp_name'], $id, $sid, $cid);
                }
                break;
示例#12
0
文件: additem.php 项目: psagi/sdo
-->
<head>
<title>Add an item</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p><strong>Added the following item</strong><br />
<?php 
/**
 * Process the file upload
 */
$was_uploaded = false;
include 'handle_upload.inc.php';
$was_uploaded = handle_upload($_FILES['media']['tmp_name']);
if ($_POST['title'] === null) {
    echo "The title field was empty - some kind of upload failure - resubmit the form";
} else {
    $to = './media/' . $_FILES['media']['name'];
    /**
     * Load the existing blog entries
     */
    $xmldas = SDO_DAS_XML::create('./blog.xsd');
    $xmldoc = $xmldas->loadFile('./blog.xml');
    $blog = $xmldoc->getRootDataObject();
    /**
     * Add a new blog entry
     */
    $new_item = $blog->createDataObject('item');
    $new_item->title = $_POST['title'];
function auto_post()
{
    handle_upload();
    ?>
    <div class="wrap">
        <h2>AWS Product Crawler</h2>
            <form method="post" enctype="multipart/form-data">
            <h3> Input ASIN (csv) </h3>
            <input type="file" id="asin_file" name='asin_file'/>
            <h3 > Email Id </h3>
            <input type="email" id="email" name='email'/>
            <br/>
             <?php 
    submit_button('Upload');
    ?>
           </form>
    </div>
    <?php 
}
示例#14
0
<?php

require_once 'db.php';
if (isset($_GET['junk'])) {
    set_sms_status($_GET['junk'], 3);
    header('Location: add_record.php?sms=1&junksuccess=1');
}
$person_id = create_record($_POST);
if (!empty($_FILES) && !empty($_FILES['photo']['name'])) {
    handle_upload($person_id);
}
if (isset($_POST['sneaksms'])) {
    header('Location: smsqueue.php');
}
$query_string = '?success=' . $_POST['firstname'] . '+' . $_POST['lastname'];
if (isset($_POST['fromsms'])) {
    $query_string .= '&sms=1';
}
header('Location: add_record.php' . $query_string);
//header('Location: person.php?id=' . $person_id);
示例#15
0
		by Jeff Minard cpg (aht) jrm.cc
		http://jrm.cc/
		
	Please read and abide by the accompanying license: 
		gpl.txt		
		-or-
		http://creativecommons.org/licenses/GPL/2.0/
*/
require "cpg.php";
if ($_GET['image']) {
    // selected image from bookmark or get form
    $file = $_GET['image'];
}
if ($_FILES['userfile']['tmp_name']) {
    // Upload detected captain!
    handle_upload();
}
// Recommended Image Form Items
$recommended = get_image_list($rec_image_dir);
// User Submitted Image
$user_submitted = get_image_list($image_dir);
// Steps Form Options
$step_options = get_steps_list();
// Methods!
$method_options = get_method_list();
if ($file) {
    // hoooo buddy, process the image.
    $color_palette = get_color_palette($file);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">