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

  • Home
  • SEARCH
  • 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 6890393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:16:34+00:00 2026-05-27T06:16:34+00:00

I am using Uploadify and class.upload.php for uploading and manipulating images. here are my

  • 0

I am using Uploadify and class.upload.php for uploading and manipulating images.
here are my code.

require_once('/style/scripts/crop/class.upload.php');
    if (!empty($_FILES)) {
         $uc = $this->input->post('username');
         $_REQUEST['folder'] = "/project/user/".$uc."/pages".$_REQUEST['folder']."/images/gallery";
        $targetPath = $_SERVER['DOCUMENT_ROOT'] .$_REQUEST['folder']. '/';
        $pic_temp = random_string('alnum',10);
        $handle = new Upload($_FILES['Filedata']);
            if ($handle->uploaded) {
                $handle->file_src_name_body      = $pic_temp; // hard name
                $handle->file_overwrite          = true;
                $handle->file_auto_rename        = false;
                $handle->image_resize            = false;
                $handle->image_ratio_y           = false;
                $handle->image_x                 = ($handle->image_src_x < 400)?$handle->image_src_x:400;
                $handle->file_max_size           = '999999'; // max size
                $handle->Process($targetPath);
                $handle->clean(); 
                if ($handle->processed)
                    $json = array("result"      => 1, 
                                  "file"        => $_REQUEST['folder'].'/'.$handle->file_dst_name.'?'.time(),
                                  "imagewidth"  => $handle->image_dst_x,
                                  "imageheight" => $handle->image_dst_y
                                 );
                else
                    $json = array("result" => 0);

                $encoded = json_encode($json);
                echo $encoded;
                unset($encoded);    
            } 
            else { 
                $json = array("result" => 0);
                $encoded = json_encode($json);
                echo $encoded;
                unset($encoded);
            }

Now i want to check the file size before upload,
if a image with more than 1MB in size then it should be re-sized [No cropping or other things…] to save Disk space.
if it is less then 1MB it should be uploaded directly.

How can i achieve this ?

The project is doing with Codeigniter framework.

  • 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-05-27T06:16:35+00:00Added an answer on May 27, 2026 at 6:16 am

    When a file is uploaded, you can access it at:

    $_FILES['some_name']['tmp_name']
    

    So to check it’s size, you could do something like:

    $size = filesize($_FILES['some_name']['tmp_name']);
    

    See the documentation on filesize for more information.

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

Sidebar

Related Questions

I am uploading files using the upload() method of the FileReference class. I want
We are using FTPWebRequest class in my project to upload PDF files. For uploading
I am using Uploadify to upload files. Problem is, I need to inform users
How should I handle image uploading using PHP? How should I handle the chmod
I am currently uploading files in ActionScript 3 using the upload() method of the
I want to write a jQuery file uploading program, using this plug-in http://aquantum-demo.appspot.com/file-upload Despite
I need to upload images using symfony, but ive not been able to do
Can someone please advise on uploading a file using the DAV protocol in PHP?
I am trying to upload files using Java URL class and I have found
Greetings, I'm uploading an image to my server using the following code: http://cocoadev.com/index.pl?HTTPFileUploadSample However,

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.