Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9222559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:51:39+00:00 2026-06-18T03:51:39+00:00

I am using php class upload http://www.verot.net/php_class_upload.htm I want to and trying to upload

  • 0

I am using php class upload
http://www.verot.net/php_class_upload.htm

I want to and trying to upload a image file and resize it.
But there is some problem when I click save button.

Notice: Undefined index: profilepic in C:\xampp\htdocs\projects\pakistanihaider\admin\profile.php on line 47

Here is what I have done so far

HTML
My form tag:

<form class="form-horizontal row-fluid" enctype="multipart/form-data" method="post" action="<?php $_PHP_SELF ?>">

input file tag:

       <?php //Profile Picture ?> 
        <div class="form-row control-group row-fluid">
          <label class="control-label span3" for="search-input">Profile Picture</label>
          <div class="controls span7">
            <div class="input-append row-fluid">
              <input type="file" name="profilepic" class="spa1n6 fileinput" value="<?php echo $showprofilepic; ?>" id="search-input">
              </div>
          </div>
        </div>

PHP
For class upload i included the class php file.

error_reporting(E_ALL);

// we first include the upload class, as we will need it here to deal with the uploaded file
include('./include/imageupload/class.upload.php');

Second i used this as i don’t know why they used it but they used this php in demo page

//Picture/File Upload Function
// retrieve eventual CLI parameters
$cli = (isset($argc) && $argc > 1);
if ($cli) {
    if (isset($argv[1])) $_GET['file'] = $argv[1];
    if (isset($argv[2])) $_GET['dir'] = $argv[2];
    if (isset($argv[3])) $_GET['pics'] = $argv[3];
}

// set variables
$dir_dest = (isset($_GET['dir']) ? $_GET['dir'] : '../userUploads/profile-pictures');
$dir_pics = (isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);

Now the main code that if form button is clicked..

if(isset($_POST['savebtn'])){

$full_name = $_POST['full_name'];
$job_title = $_POST['job_title'];
$email = $_POST['email'];
$dob = $_POST['dob'];
$mobile = $_POST['mobile'];
$phone = $_POST['phone'];
$nationality = $_POST['nationality'];
$profile_image = $_POST['profilepic'];
$address = mysql_real_escape_string($_POST['address']);
$about_me = mysql_real_escape_string($_POST['aboutme']);

$last_updated = date('F j, Y, g:i a');


// ---------- IMAGE UPLOAD ----------

    // we create an instance of the class, giving as argument the PHP object
    // corresponding to the file field from the form
    // All the uploads are accessible from the PHP object $_FILES
    $handle = new Upload($_FILES['profilepic']);

    // then we check if the file has been uploaded properly
    // in its *temporary* location in the server (often, it is /tmp)
    if ($handle->uploaded) {

        // yes, the file is on the server
        // below are some example settings which can be used if the uploaded file is an image.
        $handle->image_resize            = true;
        $handle->image_ratio_y           = true;
        $handle->image_x                 = 300;

        // now, we start the upload 'process'. That is, to copy the uploaded file
        // from its temporary location to the wanted location
        // It could be something like $handle->Process('/home/www/my_uploads/');
        $handle->Process($dir_dest);

        // we check if everything went OK
        if ($handle->processed) {
            // everything was fine !

            $uploadresult = '  <b>File uploaded with success</b><br />';
            $uploadresult .= '  <img src="'.$dir_pics.'/' . $handle->file_dst_name . '" />';
            $info = getimagesize($handle->file_dst_pathname);
            $uploadresult .= '  File: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
            $uploadresult .= '   (' . $info['mime'] . ' - ' . $info[0] . ' x ' . $info[1] .' -  ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB)';

        } else {
            // one error occured

          $uploadresult = '  <b>File not uploaded to the wanted location</b><br />';
          $uploadresult .= '  Error: ' . $handle->error . '';

        }

        // we now process the image a second time, with some other settings
        $handle->image_resize            = true;
        $handle->image_ratio_y           = true;
        $handle->image_x                 = 300;
        $handle->image_reflection_height = '25%';
        $handle->image_contrast          = 50;

        $handle->Process($dir_dest);

        // we check if everything went OK
        if ($handle->processed) {
            // everything was fine !

            $uploadresult2 = '  <b>File uploaded with success</b><br />';
            $uploadresult2 .= '  <img src="'.$dir_pics.'/' . $handle->file_dst_name . '" />';
            $info = getimagesize($handle->file_dst_pathname);
            $uploadresult2 .= '  File: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
            $uploadresult2 .= '   (' . $info['mime'] . ' - ' . $info[0] . ' x ' . $info[1] .' - ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB)';

        } else {
            // one error occured

            $uploadresult2 = '  <b>File not uploaded to the wanted location</b><br />';
            $uploadresult2 .= '  Error: ' . $handle->error . '';

        }

        // we delete the temporary files
        $handle-> Clean();

    } else {
        // if we're here, the upload file failed for some reasons
        // i.e. the server didn't receive the file

        $failedupload = '  <b>File not uploaded on the server</b><br />';
        $failedupload .= '  Error: ' . $handle->error . '';

            }






$success = update_profile($full_name, $dob, $nationality, $address, $mobile, $phone, $job_title, $about_me, $profile_image, $last_updated, $email);



}

I am not using image for updating the database for now, thats why I didn’t use image variable in update_profile function.

Now the problem is whenever I click save button I get undefined index??

How to solve this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:51:41+00:00Added an answer on June 18, 2026 at 3:51 am

    Simply delete this line

    $profile_image = $_POST['profilepic'];
    

    in main code.

    File are send in _FILES array so it is not set in _POST and You get notice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this php class ( http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php ) for creating the different sized images
Language: PHP / Using Class Upload by Colin Verot About: Multiple Uploading The code
I am uploading video on twitvid using its official php library. http://www.martin-gardner.co.uk/twitvid/twitvid.class.example.php#embedvideo But when
I am using the multi-upload plugin found at: http://www.fyneworks.com/jquery/multiple-file-upload/ This is what I am
I am trying to upload a file so Amazon S3 Server using PHP. So
I am trying to upload file on HTTP server using POST but when I
I am compressing an image using following class.. <?php class SimpleImage { var $image;
Am using below third party API in my project development http://undesigned.org.za/2007/10/22/amazon-s3-php-class I have done
i'm using the DOMdocument class in php whenever i want to create a XML
I'm trying to send mail using phpMailer. It's my code: <?php require_once('phpmailer/class.phpmailer.php'); $mail =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.