Jump to content

Search the Community

Showing results for tags 'sessions and $_file'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I am using a page to upload an image. Here are the code. This is working. My problem is when the user login and when there is session variables this is not working. please help. error is Notice: Undefined index: uploaded Main page <?php session_start(); if($_FILES['uploaded']['name']!== ''){ $target = "images/books/"; include("upload_image.php"); //Rename image $original_name=basename($_POST['uploaded']['name']); if($upload_file==1){ rename("images/books/$original_name","images/books/$book_id.jpg"); } ?> echo "<form action='' method='POST' enctype='multipart/form-data'><table cellpadding='2' cellspacing='2' border='0'>"; echo "<tr><td></td><td><input class='input-file uniform_on' type='file' name='uploaded' /></td>"; echo "</table></form>"; upload_image.php <?php $target = $target . basename($_POST['uploaded']['name']) ; $upload_file=0; $Err_count=0; if (filesize($_POST['uploaded']['tmp_name']) < 300000){ //300KB if(($_FILES['uploaded']['type'] == 'image/jpg') || ($_FILES['uploaded']['type'] == 'image/jpeg')){ if(is_uploaded_file($_POST['uploaded']['tmp_name'], $target)) { $upload_file=1; $Err_count=0; Info ("The file ". basename( $_POST['uploaded']['name']). " has been uploaded and renamed to relevant image file"); } else { Error ("Sorry, there was a problem uploading your file"); $Err_count=1; } } else{ $Err_count=2; Error ("Your file is not an image of jpg or jpeg"); } } else{ $Err_count=3; Error ("Your file is too large. Please upload less than 300KB"); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.