SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Threaded View

  1. #1
    SitePoint Zealot 8Observer8's Avatar
    Join Date
    Jul 2013
    Location
    Russia
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I cannot upload a jpg-file.

    Hi,

    I cannot upload a jpg-file.

    PHP Code:
    <?php
    $name 
    $_FILES['file']['name'];
    $tmp_name $_FILES['file']['tmp_name'];

    if (isset(
    $name)) {
        if (!empty(
    $name)) {
            
    $location 'uploads/';
            if (
    move_uploaded_file($tmp_name$location.$name)) {
                echo 
    'Uploaded.';
            } else {
                echo 
    'There was an error.';
            }
        } else {
            echo 
    'Please choose a file.';
        }
    }
    ?>

    <form actoin="index.php" method="POST" enctype="multipart/form-data">
        <input type="file" name="file" /> <br />
        <br />
        <input type="submit" value="Submit" />
    </form>
    Output:
    85.png

    Thank you!
    Last edited by SpacePhoenix; Sep 10, 2013 at 23:42. Reason: placed php tags around php code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •