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 4087012
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:48:04+00:00 2026-05-20T18:48:04+00:00

I could really, really, really use some help. I have looked everywhere on some

  • 0

I could really, really, really use some help. I have looked everywhere on some detailed documentation (for dummies) on using ASIFormDataRequest for photo uploads. Can someone through me a life line here?

Here is what (in relevance pieces) I have though I know I may be way off.

Camera.h

#import <UIKit/UIKit.h>
@class ASIFormDataRequest; 

...

Camera.m

#import "Camera.h"
#import "ASIHTTPRequest.h"
#import "ASIFormDataRequest.h"

...

- (void)uploadImage:(NSData *)imageData filename:(NSString *)filename{
NSURL *url = [NSURL URLWithString:@"http://moosesightings.com/test.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
// Upload a file on disk
[request setData:imageData withFileName:filename andContentType:@"image/jpeg" forKey:@"userfile"];
[request setDelegate:self];
[request startAsynchronous];
}

...

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:YES];
[picker.view removeFromSuperview];
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSString *imageName = @"uploaded.jpg";

// Save image
//UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
[self uploadImage:UIImageJPEGRepresentation(imageView.image, 1.0) filename:imageName];

captionControls.hidden = NO;
[textView becomeFirstResponder];

[picker release];
}

Here is the script I have receiving it.

$dir_dest = 'uploads/';
ob_start();
print_r($_FILES);
$test = ob_get_contents();
ob_end_clean();
$db->insert('connecttest', array('ts'=>date('Y-m-d H:i:s'), 'tempfield'=>$test))->execute();

Here is the result I get

Array
(
    [(null)] => Array
        (
            [name] => (null)
            [type] => (null)
            [tmp_name] => C:\Windows\Temp\phpCFF0.tmp
            [error] => 0
            [size] => 0
        )

)

Please help 🙁

  • 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-20T18:48:05+00:00Added an answer on May 20, 2026 at 6:48 pm

    I faced similar problem, i re-sized the image using

    UIImage *im = [info objectForKey:@"UIImagePickerControllerOriginalImage"] ;
    UIGraphicsBeginImageContext(CGSizeMake(320,480)); 
    [im drawInRect:CGRectMake(0, 0,320,480)];
    newImage = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext();
    NSData* imageData=UIImageJPEGRepresentation(newImage, 0.5); 
    

    and it started working, the height and width of the captured image will be more than 2000×2000 so reduce it and give a try.

    [request setData:imageData withFileName:@"photo.jpg" andContentType:@"image/jpeg" forKey:@"file"];
    

    and this is the php script.

    $filename="uploaded";
    $target_path = "uploads/";
    $target_path = $target_path .$filename.".jpg"; 
    if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
    echo "uploaded an image";
    } else{
        echo "There was an error uploading the file, please try again!";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a piece of code here that i really could use some help
I could really use some help with what I have a feeling will be
I have been struggling with this for a while and could really use some
I could really use some help optimizing a table on my website that is
I made a big oops, and could use some help undoing it. We have
I can't get my head around this and I could really use some help.
This seems to be an overlooked area that could really use some insight. What
I've inherited a rather large application that really could use some cleanup. There is
I've been fighting this problem for many hours now and could really use some
After two days of searching, I'm stuck and could really use some assistance. I

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.