Exemplo n.º 1
0
<?php

require_once 'requires/header.php';
if (isset($_POST['update_profile'])) {
    require_once 'requires/functions.php';
    if (\ECVChat\checkUpload('filedata')) {
        $picture = \ECVChat\uploadFile($_FILES['filedata']);
        $upload = $picture[0] . $picture[1];
    }
}
if (isset($upload)) {
    $pic = $upload;
} else {
    if (isset($_SESSION['photo_url'])) {
        $pic = $_SESSION['photo_url'];
    } else {
        $pic = '';
    }
}
?>

<div>
  <form enctype="multipart/form-data" action="profile.php" method="post">

    <fieldset>
      <legend>Your personal information</legend>
      <p>
        <input type="hidden" name="update_profile">
        <img width="120" src="<?php 
echo $pic;
?>
Exemplo n.º 2
0
<?php

require_once 'session.php';
require_once 'functions.php';
$error = "";
if (ECVChat\checkUpload('filedata')) {
    list($name, $extension) = ECVChat\uploadFile($_FILES['filedata']['name']);
    $path = 'uploads/';
    $imageId = ECVChat\DB\updateUserImage($_SESSION['id'], $name, $path, $extension);
    $_SESSION['photo_id'] = $imageId;
    $_SESSION['photo_url'] = $path . $name . "." . $extension;
} else {
    $error = "The uploaded file isn't found.";
}
include 'header.php';
?>
<div>
  <form enctype="multipart/form-data" action="" method="post">
    <fieldset>
      <legend>Your personal information</legend>
      <p>
        <?php 
if ($_SESSION['photo_id'] != null) {
    echo '<img width=120 src="' . $_SESSION['photo_url'] . '"><br>';
}
?>
        <label for="filedata">Picture :</label>
        <input name="filedata" type="file" />

        <input type="submit" value="Send file" />
      </p>
Exemplo n.º 3
0
        <label for="filedata">Picture :</label>
        <input name="file" type="file" />
        <br>
        <label for="file-url">Picture URL :</label>
        <input name="fileUrl" size="64" type="text" />

        <input type="submit" value="Send file" />
      </p>
    </fieldset>
  </form>
  <div class="error"></div>
  <a href="logout.php">Log out!</a>
  <a href="chat.php">Go to the chat!</a>
</div>

<?php 
if (isset($_POST["file"])) {
    if (ECVChat\checkUpload($_FILES["file"])) {
        $info = ECVChat\uploadFile($_FILES["file"]);
        echo $info;
    }
} else {
    if (isset($_POST["fileUrl"])) {
        if (ECVChat\checkUpload($_FILES["fileUrl"])) {
            $info = ECVChat\uploadFile($_FILES["fileUrl"]);
            echo $info;
        }
    } else {
        echo 'nothing';
    }
}